Greetings. I’m currently finishing off a GPU based kd-tree range search and the Visual Studio Cuda Debugger is suggesting some bizzare errors I don’t understand.
My code takes an element out of an array at the position equal to it’s thread id. Thread 0 will load array, thread 1 array ect. The value loaded from the array is then used as a pointer to values in other arrays throughout the kernel.
When running the debugger, about half way through the kernel, the variable which holds the value loaded from the array will magically change to a value from a different array position. So for the first half of the kernel my code will be dealing with the value from array and upon entering a fixed-sized for loop the debugger will state the array value has changed to that of array - without re-hitting any of the code breaks higher up in the kernel.
The first time this happened was in a branching if-statement later in the code. I replaced the entire branch with a single xor statement and now the change happens higher in the code (in a for loop).
Does anyone know if:
a)The cuda debugger ever jumps between different kernel runs mid kernel instead of finishing the kernel being debugged.
b)Any factors which cause variables to modify themselves without any statements which would cause them to do so?
c)Any false assumptions I’ve made about the cuda debugger? The arrays im using reside in global memory and the local variables in each kernel as small enough to fit in the kernels. I can post the code which the error happens in, but its a very long piece to work through :/
Edit: If I instruct the Visual Studio based Cuda Debugger to continue to the next break point, it will swap the array position. If I manually proceed to the next line of code, one line at a time, the code behaves as it should. If anyone knows what this behaviour is, id appreciate it.