Bit wise reproducibility


I have a piece of code which fails to exhibit bit wise comparability when the same executable is run repeatedly, i.e. each time the executable is run it produces different results.

It does this when compiled with both Intel and PGI compilers using O2.

However, with Intel, I do get bit wise reproducibility if I include the -fp precise and -fp source flags.

So really what I am asking, is there an equivalent to -fp precise and -fp source with PGI. I already use the -Kieee flag but it doesn’t solve the problem.


Hi CliveUK,

“-Kieee” would be the equivalent flag. However, this only applies to floating point computation and I think something else might be going on.

When applying optimization, it’s quite common to see slight variance in the generated results. However, I would expect that different runs of the same binary would be consistent, unless parallelization was being applied.

I would double check your code for memory issues using Valgrind ( You may be reading some uninitialized variable or have an out-of-bounds access.

Hope this helps,

Thanks Matt but I have already done a valgrind analysis and haven’t found anything obvious.

Having said that, I am deeply suspicious of the code, it wasn’t written by me, and the Intel flags are probably just a means of masking what the real problem is.