Can -acc generate different numerical results ?

Hi all,

I’ve upgraded PGI compiler from 18.3 to 19.1. Fortran+OpenACC code I’m working with generated different/invalid numerical results.

I have tried to narrow down the problem and it turned out that different results are generated when -acc is switched on for a single file which contains only data copying directives (no acc kernels or acc loops).

Moreover, I’ve commented out all data copying directives (as well as all other acc directives in the code) and the results are still different with and without -acc option for this single file.

I’m not sure how to proceed with it… should I try to play with switching on/off different compiler options encapsulated within -acc ?

Regards,
Maciej

Hi Maciej,

Hmm. The only thing I can think of is that “-acc” will force some optimization needed for dependency analysis to be enabled. Hence, I would expect the same differences between using “-O0” and “-O2”.

You might try adding “-Kieee” to have the compiler adhere to strict IEEE 754. Though, this wont account for order of operation differences in parallelization or vectorization.

If you do get bad numerical results at higher optimization, you may want to investigate exactly what operations are causing the problem.

Do you have reductions?
Do you have an if statement that’s checking for equality of a real?
Do you use transcendental or trigonometric routines?
Does the compiler feedback messages (-Minfo) give clues as to what optimizations are being applied? In particular, look for vectorization and/or unrolling which can change the order of operations.

-Mat