race condition

if many threads are accessing to the same memory address, how do the hardware

detect that, or instead the compiler fixes it.

I open 10 threads, write to the same address.

When I dump the value of that address, the value is always the same.

so I am wondering if there is some mechanism to solve the race condition.

Maybe 10 threads writes to the same address, but only the value written by one thread would be put

into the memory, so there is no need to write others threads value <- I guess.

For reading use constant memory.
For writting - check programming guide
For reading and writting, in general, expect race conditions.

The hardware does not deal with race condition.

The programming guide states that if multiple threads try to write to the same address, only one write will succeed, but it is no guaranteed which one will.

If you issue writes to the same address from 10 threads in the same block, I think the order in which the writes arrives at the memory controller is determined, as least for the same type of GPU. Thus you can expect the result to be always the same. But if you use multiple blocks, the result may vary from run to run.