Atomic Add 1.3 Float/Double Atomic Add


Are double precision atomic operations supported on 1.3 hardware? I might have multiple threads writing double/float into the same location in an array.



No, there are none. (x86 doesn’t have atomic doubles either).

There also aren’t explicit float atomics, but they can with a bit of wrapper code be implemented using atomicExch. This is also like the CPU.

However, you can implement atomic (anything) by switching to a critical-section like lock, using atomicExch to pass around an exclusive flag among threads.

This can be useful in many contexts like initial work assignment or final analysis, though its performance is (as expected) pretty poor.

I remembered someone gave a function for atomicFloatAdd(), you can find it in this forum.

Yes. I found it here

There is also an example in the latest programming guide.