Bug in pgf90 v. 14.3 + OpenMP

Hi all. I’d like to inform about the bug in pgf90 + OpenMP. We spent about 8 hours trying to find an error, eliminating lines of the code, switching off modules etc. Finally only 13 lines were left:

program bug
!$OMP PARALLEL DEFAULT(PRIVATE)
!$OMP DO
DO KK=1,5
DO IO=1,3
IF(IO.EQ.3) write(,) ORTL/(ORTL-ORTR),ORTL/(ORTL-ORTR)
IF(IO.EQ.1) ORTL=1.0
IF(IO.EQ.2) ORTR=2.0
ENDDO
ENDDO
!$OMP END DO
!$OMP END PARALLEL
end program bug

If it is compiled by pgf90, everything goes fine. The output looks (as expected) like:

-1.000000 -1.000000
-1.000000 -1.000000
-1.000000 -1.000000
-1.000000 -1.000000
-1.000000 -1.000000

Now compile it with -mp option, to run it parallel. The output in this case looks quite strange:

-0.5000000 -1.000000
-0.5000000 -1.000000
-0.5000000 -1.000000
-0.5000000 -1.000000
-0.5000000 -1.000000

:-(

Changing the values of ORTL in ORTR variables, we conclude, that the compiler considers ORTL=0 during first evaluation of (ORTL-ORTR), but everywhere else uses the correct value (ORTL=1.0 in this example)

Intel compiler doesn’t have this problem and generates correct output in both cases.

Hi Anton,

Thanks for the report. I am sorry to learn of this issue. I have filed a report on this with our developers as TPR #20543. We will keep you posted as to when this issue is fixed.

Best regards,

+chris

Anton,

Our developer has investigated the bug, and is working on a fix.

In the meantime, he suggested you could modify your code as follows to work around the issue:

after the !$OMP PARALLEL DEFAULT(PRIVATE), introduce an assignment to ORTL

!$OMP PARALLEL DEFAULT(PRIVATE)
ORTL = 0

Hope this helps.

Best regards,

+chris

from f77 days, i always define and initialize a variable before using it.

TPR 20543 - UF: OpenMP code gets wrong answers

has been corrected in the PGI 14.7 release.

thanks,
dave