On 10/29/2013 08:53 PM, Erik Schnetter wrote:
I have just found several instances of "OpenMP parallel do" constructs in GRHydro that did not mark loop variables as private. This is a severe parallelization error that can lead to wrong results in ways that are very difficult to debug.
I wonder why the compiler does not flag this. I suggest a code review before the release.
While it is true that the loop index of the loop that is parallelized (usually only the outermost loop) does, in Fortran, not have to be declared as private, all other loop indices still have to be declared as private. In C, all loop indices have to be declared as private. Personally, I find it simplest to just declare all loop indices as private.
I though that for C code, the (outermost) loop index was automatically private. Has this changed in the openmp standard?
This is correct: !$OMP PARALLEL DO PRIVATE(i,j,k) do k=1,nz do j=1,ny do i=1,nx
And this would be wrong: !$OMP PARALLEL DO do k=1,nz do j=1,ny do i=1,nx
-erik
Users mailing list Users@einsteintoolkit.org http://lists.einsteintoolkit.org/mailman/listinfo/users