OMP code notes
OMP coding
Note 1
private/shared
For a parallel do loop you must declare shared and private variables. shared variables have a single version and all threads write to the same memory space. private variables are specific to each thread. The current default is for all variables to be shared, it is ideal to define the type of each variable to reduce bugs. ie use DEFAULT(NONE)
If you initialize a private variable outside of the parallel loop you will have a private and a shared version of the variable, which can lead to errors.
Using ATOMIC can be dangerous the method holds the memory space while it reads the variable but does not hold it while it writes. It is best to use critical or flush the variable after the atomic command $COMP FLUSH(var)