Hi there, I'm wondering how to do what seems like a fairly simple task. I want each thread to increment an integer, so that if 30 threads are run on a the gpu device, the counter will be 30.
I'm assigning the integer counter as global memory ( __global int* _nsamp) and using a simple
*nsamp += 1;
operation on it to increment it, how do I ensure that the threads write to it in order so there are no threading issues? at the moment the nsamp value is not the total number of threads that have run as I'd like it to be.
thanks in advance.