1unsigned int atomicInc(unsigned int* address,
2 unsigned int val);
3//reads the 32-bit word old located at the address address in global or shared memory,
4//computes ((old >= val) ? 0 : (old+1)),
5//and stores the result back to memory at the same address.
6//These three operations are performed in one atomic transaction.
7//The function returns old.
8
9//example of use
10int idx = atomicInc(&array[i], n);