[Users] Fortran OpenMP parallel do
Ian Hinder
ian.hinder at aei.mpg.de
Wed Oct 30 06:24:30 CDT 2013
On 30 Oct 2013, at 01:53, Erik Schnetter <schnetter at cct.lsu.edu> 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.
>
> 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
Surely this would give results so wrong that they would be noticed? Is it possible that the compiler is automatically declaring the variables as private, without emitting a warning? Are the routines with the bugs actually used for physics yet, and have they been validated?
PS: #include <usual rant about lack of a reproducible correctness-testing framework for the Einstein Toolkit>
--
Ian Hinder
http://numrel.aei.mpg.de/people/hinder
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.einsteintoolkit.org/pipermail/users/attachments/20131030/1b7bf8a4/attachment.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 203 bytes
Desc: Message signed with OpenPGP using GPGMail
Url : http://lists.einsteintoolkit.org/pipermail/users/attachments/20131030/1b7bf8a4/attachment.bin
More information about the Users
mailing list