Ok, so previously I was using atomicAdd and atomicExch in my CUDA code and it wouldn’t compile. In order to get my code to compile I took the following step
However, since then I’ve been getting weird results from my code, particularly the section using the atomic functions. So I added the following line into
#ifndef CUDA_NO_SM_11_ATOMIC_INTRINSICS std::cout << "Wait, I'm not using atomics?" << std::endl; #endif
Since I saw the above text print out on my console, does this mean that I’m not actually using atomic operations?
I’m using atomics in an SPH simulation and during grid generation I need to add the particle id, and increment the counter (this is one of the methods described in the CUDA SDK). In the manner shown below.
atomicExch(&dev_grid[ some_offset ], dev_particles[tid].id); atomicAdd( &dev_counters[yet_another_offset], 1);
So clearly if atomics aren’t working then I would see some pretty bizarre results when i print out the contents of grid cells (which is what I’ve been seeing).
Anyway, I’m just hoping someone might have some insight into the problem. Thanks for looking. :)