2

In CUDA, is the result of atomic operation immediately visible to the threads of other warps in the same block as the one performing the atomic operation? In case of non-atomic operation, I know that the result may not be visible until __syncthreads() gets called.

einpoklum
  • 118,144
  • 57
  • 340
  • 684
small_potato
  • 3,127
  • 5
  • 39
  • 45

1 Answers1

3

Yes, by definition, atomic operations are completed and visible before any other thread executing an atomic operation on the same address accesses the same value.

However, it is possible to have a race condition if other threads access the same address via a non-atomic access at the same time, so you still must be careful to write correct concurrent code.

harrism
  • 26,505
  • 2
  • 57
  • 88