atomic - OpenCL - atomic_cmpxchg -


what function do??. couldn't understand thing opencl specification!! code below snippet spmv code.

atomic_cmpxchg((__global int*)loc, *((int*)&old), *((int*)&sum)) != *((int*)&old) 

atomic_cmpxchg "atomic compare , exchange". implements atomic version of standard c99 ternary operation. code above implies atomic equivalent of following:

p = *loc; *loc = (p == *old) ? (*sum != *old) : p; 

with atomic_cmpxchg call returning p. operation atomic, means no other thread can read or write loc until transaction completed.


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -