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

Release built produce different results before and after refactoring

yzh15
Beginner
536 Views

Hi, 

Recently I did some refactoring work and verified that the original code and refactored code will produce exactly the same results under Debug mode. 

 

However, if I switch to Release mode. the original code and refactored code will produce slightly different results, the difference is around the scale of 10^-10 ~10^-15. It looks like it's some precision issue. I'm wondering why there's such difference ? Is there anyway to remove this difference ?

 

Although the difference is small,  but maybe because the refactored code needs to be run millions of times, the final results is very different. 

 

I'm using Intel(R) Visual Fortran Compiler 16.0 [Intel(R) 64]

 

Thanks,

0 Kudos
2 Replies
Steve_Lionel
Honored Contributor III
528 Views

Please see Improving Numerical Reproducibility in C/C++/Fortran

 

This discussion on StackOverflow, especially the first answer, is also relevant: fortran - MATMUL result not equal with explicit calculation for double precision? - Stack Overflow

yzh15
Beginner
507 Views

Thanks! That slides fixed the problem. 

0 Kudos
Reply