This is an odd behaviour to describe, and I doubt I’ll be able to accurately describe it in a way that could pin point down the bug.
In short, have a [Fortran90] function (aeroprop), which I copied to another file where both the original signal (X) and differentiated (dX) signal are outputted.
I typically test all my code in the GNU compiler before the PGI compiler, mostly because the GNU compiler offers more compiling warnings, and I assume working in both compilers is a good test… That leads me to the problem I struggled for three days on (and am not convinced I solved.)
To test this code, I was matching the output X. When compiled with gfortran, the outputs were identical (at least down to a tolerance of 1e-10), but they were different by up to 1e-2 when compiled with PGI.
So, code from file A (aeroprop) and file B were outputting different signals (in signal X, not dX), the code for anything that could affect X was identical across both files.
More over, I found that if I commented out a variable that’s never read (for signal X), then the concentrations in X would be identical in the PGI compiler.
I don’t know what to make of this problem. Strangly enough, changing this line:
TRAMASS= max(1.0e-33, rgrid(i,l,no))
to use 1.0e-7 rather than 1.0e-33 fixed it (but -8 would have the problem.) I bet this is only fixing it by coincidence.
In any case, the code files are too long to post here, even the ones I truncated down to focus in on the offending lines, and I realize my description is too vague to solicit a fix, but I am interested in suggestions.
Has anyone encountered something like this? Or have suggestions on how to proceed?