I have a kernel where multiple threads can write to the same memory location. However, the threads always write the same value. But I just want to confirm that writing a float or int is an atomic operation.
Yes, writing a ‘float’ or an ‘int’ is an atomic operation. However, depending on what the code does (it is not clear what you mean by “the threads always write the same value”) there may still be a race condition in your code because only the threads belonging to the same warp are guaranteed to execute in lockstep.