Dear Intel Experts,
I describe here an issue relative to control on math lib to be used by an application under Linux.
1. When a compiled fortran code is executed, the computation time is T
2. When this same fortran code is transformed as a dynamic lib of a C++ application, the execution is 5*T.
It was identified that cos() calls in the fortran code were responsible for that performance downgrade:
in configuration 1, it is cos() of lib libimf.so that is called.
In configuration 2, is is cos() of lib libm.so.6 that is called
How to keep control on Library to be used in configuration 2? I make you note that there is neither #include <cmath> nor #include <mathimf> in the C++ code.
Thanks for your help
If you prevent icc from linking its own library or force linking Linux math library before Intel libraries I suppose this may happen. One way to make this happen might be a premature superfluous -lm in the link command. Did you try verbose options such as icc -# or gcc -v to see the final library search order?
thanks for your pinpoints, it help. Yes, -lm is there in Makefile generated by CMake under linux probably because of a #include <cmath> in the C++ code..... this might (?) affect the linking order for fortran code as that code is a plugin of C++ code (so linked against it). One workaround: we enforced C++ code to link against intel math lib.