[Users] Fortran OpenMP parallel do

Yosef Zlochower yosef at astro.rit.edu
Wed Oct 30 07:54:08 CDT 2013


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 at einsteintoolkit.org
> http://lists.einsteintoolkit.org/mailman/listinfo/users
>


-- 
Dr. Yosef Zlochower
Center for Computational Relativity and Gravitation
Associate Professor
School of Mathematical Sciences
Rochester Institute of Technology
85 Lomb Memorial Drive
Rochester, NY 14623

Office:74-2067
Phone: +1 585-475-6103

yosef at astro.rit.edu

CONFIDENTIALITY NOTE: The information transmitted, including
attachments, is intended only for the person(s) or entity to which it
is addressed and may contain confidential and/or privileged material.
Any review, retransmission, dissemination or other use of, or taking
of any action in reliance upon this information by persons or entities
other than the intended recipient is prohibited. If you received this
in error, please contact the sender and destroy any copies of this
information.


More information about the Users mailing list