in my code when i call findMax function, index variable can't defined but max,i can defined and work. i so try with different names but not works. what is problem?
Asked
Active
Viewed 620 times
1 Answers
4
The CUDA compiler performs some optimizations even when you disable all optimizations. index has no side effect in the device function findMax so the compiler eliminated the variable.
Greg Smith
- 10,577
- 1
- 27
- 31
-
1What do you want to do? index doesn't matter in your code. If you modify your algorithm so index actually serves a purpose in the program, then the compiler won't be able to optimize it out. Something like `if (index) return max; else return array[0];` might work. – Robert Crovella Apr 06 '13 at 16:15