In functionality atomicSum is the same as if you used a lock, but what is the difference in latency?
This comment was marked helpful 0 times.
kayvonf
Yes. You can think of atomicAdd to operate like this.
void atomicAdd(int* addr, int value) {
lock(myLockForAddr);
*addr+=value;
unlock(myLockForAddr);
}
Of course, you wouldn't actually have a lock per memory address, that would be crazy! So atomicAdd is typically a primitive that has direct hardware support. (e.g., an atomicAdd instruction)
In functionality atomicSum is the same as if you used a lock, but what is the difference in latency?
This comment was marked helpful 0 times.
Yes. You can think of atomicAdd to operate like this.
Of course, you wouldn't actually have a lock per memory address, that would be crazy! So atomicAdd is typically a primitive that has direct hardware support. (e.g., an atomicAdd instruction)
This comment was marked helpful 0 times.