Bit operation Technical

Hello,

I am wondering does bit operations (and, or, xor) cause race condition, if the program is designed that each thread strictly operate on its designated bit?

For example: one variable is shared by 32 threads, and each thread update exactly one bit on the shared variable using bit operations (or, and, xor). Will it be race-condition free or not?

Thanks,
Yo-Ming

Bit operations will have race conditions unless you use the atomic operations described in the CUDA Programming Guide. Note that atomics only work with variables in global memory on devices with compute capability 1.1, and variables in global or shared memory on devices with compute capability 1.2.