Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Debug vs. Release question

dondilworth
New Contributor II
624 Views
I have a general question: My code gives slightly different answers in debug and release mode. After a lengthy calculation, those differences diverge more and more. What can cause this? There are lots of math calls in this rather large program, and if they come back different in the last digit, that might do it.

Any ideas of what to look for or settings to change? Here are my command lines:

/nologo /debug:full /OD /QaxAVX /Qparallel /Qip /I"Debug/" /extend_source:132 /pad_source /warn:none /debug-parameters:used /Qguide-file:"Debug\\SYNOPSYS200_lib_.gap" /Qsave /align:commons /assume:byterecl /Qzero /Qfp_port /fpconstant /iface:cvf /module:"Debug/" /object:"Debug/" /Fd"Debug\\vc100.pdb" /traceback /check:all /libs:dll /threads /winapp /c


/nologo /debug:parallel /Oy- /Qparallel /I"Release/" /extend_source:132 /Qsave /assume:byterecl /iface:cvf /module:"Release/" /object:"Release/" /Fd"Release\\vc100.pdb" /traceback /libs:static /threads /winapp /c
0 Kudos
1 Solution
Anonymous66
Valued Contributor I
624 Views

Without seeing your code, it is impossible to know exactly what is happening, but optimizations canaffectthe results. Optimizations affect how some things are calculated andcan change the order of operations. It sounds like your code is very sensitive to small changes. If you want the same result at all optimization levels, I would suggest adding the options /fp:precise /fp:source.

For more information on the factors that can affect the consistency of floating-point calculations see http://software.intel.com/en-us/articles/consistency-of-floating-point-results-using-the-intel-compiler/

View solution in original post

0 Kudos
2 Replies
dondilworth
New Contributor II
624 Views
It gets more interesting. Different compiler optimizations give different results. In debug mode, I do a lengthy calculation and get these answers:

No optimization: 0.0809
Optimization max speed: 0.01563
Optimization minimum size: 0.00767

I would expect this to be deterministic, but it looks more like chaos. Any reason why?
0 Kudos
Anonymous66
Valued Contributor I
625 Views

Without seeing your code, it is impossible to know exactly what is happening, but optimizations canaffectthe results. Optimizations affect how some things are calculated andcan change the order of operations. It sounds like your code is very sensitive to small changes. If you want the same result at all optimization levels, I would suggest adding the options /fp:precise /fp:source.

For more information on the factors that can affect the consistency of floating-point calculations see http://software.intel.com/en-us/articles/consistency-of-floating-point-results-using-the-intel-compiler/

0 Kudos
Reply