I am trying to use the functionality of atomic operations at shared memory level for syncronizing between threads inside a block. I have a shared data structure and this structure should only be modified by one thread at a time .
I have used following code
global void …
shared float SHDATA;
shared int access;
if(threadIdx.x == 0)
access = 0;
int access_local = 1;
access_local = atomicExch(&access, access_local)
access_local = atomicExch(&access,access_local)
The above results into hanging of the GPU. The GPU needs to be rebooted in order to run any other program on the device. Do I need to modify some things in order to use Atomic operations. I have a GeForce GTX280 device which has compute capability 1.3 and hence should support atomic operations at shared mem level.
Strangely, when I reboot the computer and run this code, I get a print message which is called after the function and program hangs without completing the operations. No code runs on the device further unless I reboot it…Surely need some help here,