HPC Magazine February 2014 - Discovering OpenACC 2.0 - part II

Listing 1: Example of 2-thread non-atomic increment with race condition.


[thread1]  reg1 = X 
[thread2]  reg2 = X 
[thread1]  reg1 = reg1+1  
[thread2]  reg2 = reg2+1  
[thread1]  X = reg1 
[thread2]  X = reg2