Answers for "cuda atomic inc"

C++
-1

cuda atomic inc

unsigned int atomicInc(unsigned int* address,
                       unsigned int val);
//reads the 32-bit word old located at the address address in global or shared memory, 
//computes ((old >= val) ? 0 : (old+1)), 
//and stores the result back to memory at the same address. 
//These three operations are performed in one atomic transaction. 
//The function returns old.

//example of use
int idx = atomicInc(&array[i], n);
Posted by: Guest on February-08-2021

Browse Popular Code Answers by Language