From the book, I see when we doing atomic operation,The hardware guarantees us that no other thread can read or write the value at address addr while we perform these operations.But it make me confused, for instance:
If I have two threads(thread0 and thread1). and I have a buffer call buf, the size of the buf is two(buf and buf).The address of buf is 10000 and the address of buf is 10001.
Now,I do atomicAdd(&buffer[threadIdx.x],1).So thread0 will add 1 into buf, thread1 will add 1 into buf.My question is, it’s happend meanwhile(since the address 10000 and 10001 is different)or thread1 will do operation after thread0 finish his job?
Thanks for your help