1int atomicCAS(int* address, int compare, int val);
2//reads the 16-bit, 32-bit or 64-bit word old located at the address
3//address in global or shared memory, computes
4//(old == compare ? val : old) , and stores the result back to memory
5//at the same address. These three operations are performed in one
6//atomic transaction. The function returns old (Compare And Swap).