Hi All,
I have this code that I have mentioned previously. It is now running parallel via OpenMP. I use the code to model observations of binary stars. It seemed to be working wonderfully on this one data set. I switched data sets, and discovered a problem running in parallel mode. Basically, the parallel model started giving different results with respect to the single-core mode. I started putting write statements here and there, and found that a critical array had NaN values rather than normal numbers.
I then started using compile flags like -Mbound and -Ktrap=inexact. This is when I discovered this odd behavior:
subroutine getT0(finc,period,ecc,argper,T0,Tconj)
c
c January 30, 2010.
c
c This routine is the inverse of getcontimes. Given a time of transit,
c it will figure out the T0 needed.
c
implicit double precision (a-h,o-z)
c
pie=3.141592653589793d0
write(*,*)pie
c pie=4.0d0*atan(1.0d0) !pie=3.141592653589793d0
write(*,*)finc,pie
fincr=finc*pie/180.0d0
write(*,*)fincr
omegar=(argper+180.0d0)*pie/180.0d0
.
.
.
Here is the output when compiled without the -K flag:
3.141592653589793
89.62637196236822 3.141592653589793
1.564275287360457
Here is the output when compiled with that flag:
3.141592653589793
89.62637196236822 3.141592653589793
Floating exception
As you can see, I have tried various combinations, like simply defining pi, or using the arctan function. When I use the arctan function, the exception appears there.
I get the correct results in the parallel code that was compiled with gfortran. I could not get the floating exception, although I might not have used the correct compiler flag(s).
I have an AMD system (“piledriver”) and PGI 14.6. Here are typical compile commands:
pgf90 -mp -O2 -Mextend -tp barcelona -mcmodel=medium -o fred fred.for
(gives wrong results, but runs)
pgf90 -O2 -Mextend -tp barcelona -mcmodel=medium -o fred fred.for
(gives correct results, but single-core)
pgf90 -Ktrap=inexact -mp -O2 -Mextend -tp barcelona -mcmodel=medium -o fred fred.for
(dies)
pgf90 -Ktrap=inexact -O2 -Mextend -tp barcelona -mcmodel=medium -o fred fred.for
(dies)
I also compiled (in single-core mode) on a slightly older piledriver system with PGI version 13.6, and I get the floating point exception. As noted earlier, I cannot use the -mp flag on this older system.
I tried using the debugger, but I could not figure out how to get the debugger to tell me where the NaN values were produced.
What else can I do at this point? Any and all advice is welcome.
Jerry