I’m trying to write an application in which a segment of the code has the following needs.
1.A certain number of threads need to write into global memory
2.Upon completion of this task the rest of the threads are expected to go about there tasks
I’ve tried to implement this using
So what’s happening is one thread acts a representative and goes about changing globVal( for which I use atomicAdd(&globVal,1);) and hence once all the blocks’ representatives are done the rest of the threads can go about their computing tasks. But the strange thing is even before the globVal==26 the remaining threads seem to be somehow break out of the while loop. Been breaking my head over this anomaly for sometime now. Would really love some help.