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

Dramatically different answers with debug and release executables

bkurth
Beginner
523 Views

I am running a large FORTRAN code that is to be released to many clients.  The answers generated with the debug and release versions are VERY different and the 32 bit vs 64 bit answers are also different.  Are there known bugs or should I look for a new compiler that does not produce executable versions that give different answers for the exact same source code and exact same inputs?

0 Kudos
6 Replies
NsK
Novice
523 Views

AFAIK, the answers should agree if you're not hitting floating point exceptions.
Have you tried compiling your code in Release mode with -fp-model precise ?

0 Kudos
Steven_L_Intel1
Employee
523 Views

This is more likely to be an error in your program,(such as uninitialized variables) or perhaps an algorithm that is too dependent on small differences in intermediate calculations. There is no general compiler bug in this area.

I suggest printing out intermediate calculations to see where results start to diverge.

0 Kudos
bkurth
Beginner
523 Views

Actually there is a problem with one of your compiler settings but I will let you find it.  We have people from all over the world checking the code so I am as sure as a programmer can be it is not a source code problem.  Of course stating that two executables compiled from the same source code would produce two different results and it must be a source code, not a compiler, problem is the type of support I have come to expect from Intel.

0 Kudos
Steven_L_Intel1
Employee
523 Views

I said it was likely, based on my 35 years of experience in working with Fortran applications.There are quite a few coding errors that can cause such results and I have seen issues in codes that have been used for decades.  If after you have done some level of diagnostic effort such as I suggested and you still think there's a compiler problem, please provide us with everything we need to reproduce the problem (including all sources and build info) and we'll be glad to investigate.

0 Kudos
lklawrie
Beginner
523 Views

It's very difficult.  We have similar problems.  Interestingly, in recent runs, the 32 bit versions on different platforms are more similar than the 32 vs 64 -- mostly small differences -- a few of our test suite files have larger differences.  Likewise for 64 bit.

A hard to solve error if it's in the source code -- have tried with several different compilers to make them abort on uninitialized variables, etc.

0 Kudos
FortranFan
Honored Contributor III
523 Views

For whatever it's worth, I work on several large libraries which support a lot of numerical computations and no noticeable differences are found in results between different configuration (Debug/Release) and platform (32-bit/64-bit) versions.  These libraries were originally developed in older dialects of FORTRAN (77 to IV and prior) and they made extensive use of "non-standard" compiler-specific extensions.  Code "clean up" as guided by various compiler options - see Steve's suggestions - was necessary.

Now there were some occasions where an "internal compiler error" (ICE) got in the way, but these got fixed by Intel in their later compiler updates.  However, the ICEs were always independent of the build setting.  I never encountered a scenario where the compiler by itself caused different behavior based on configuration or platform - when it occured, it was always due to poor programming practice. 

0 Kudos
Reply