All threads are potentially accessing and changing the same values, maxloc and maxval.
#pragma omp atomic
#pragma omp critical
Atomic may be faster than critical but depends on hardware