I developed a FORTRAN (F90) code (its a large model) with the following compilation flags :
ifort -g -O0 -openmp -openmp_report -threads -ipo
When running this code with the above flags, I keep the results within 15 digits after the dot when running serial or parallel (OpenMP). I have also checked with Intel Inspector 2013 - and I do not have any data race condition in either if the subroutines.
However, when I change the optimization compilation flag to -O2 or -O3, I get small error which growth with time (its a simulation which integrates with time) from the 15 digit toward larger numbers. I would like to prevent this from happening. The results with either -O2 or -O3 are different (up to the fifth digits after the dot).
Can anyone advise on how can I, in general, improve my code (or some other compilation flags) in order it to run with the same precision (double precision) as with -O0 flag ?
Thanks in advance,