I'm working on a large-ish numerical simulation program, mainly written in Fortran, that is compiled with Intel Fortran compiler (v18.0.3).
Recently, I have come across a mysterious issue: if I link the program with the external libraries as absolute paths, the numerical results are slightly different when compared to the program linked with -L/path/to/lib -lnameOfLib
I have checked the following:
strace
and in both cases the same libraries are loaded and they are loaded in the same order;-check all -ftrapuv
there are no warnings or errors;diff
on them.I am out of options to check why this happens. I would be glad if someone could suggest further how to deal with this problem and where the differences could originate.
I'm going to conclude the following, based on this explanation. When linking with /usr/lib/libm.so, the platform libm.so
will be used. When linking with -lm
, the Intel compiler will alter the linking command to also link the Intel math library libimf.so
. Apparently, these different implementations will give numerical roundoff error leading to the differences.