HPC - Linking to Intel ICC/IFC Compiled Libraries

Sometimes your Linux system may contain a whole lot of mixed software that you may not want to mess with to avoid breaking a machine(or parts of it) that's running in a production environment.

In a cluster I worked at, we had a library compiled with Intel's compiler because is better performing in Intel's processors. The machine had the FFTW library compiled with ICC/IFC and upon linking a program compiled with GCC Fortran compiler, I was greeted with this error:

/usr/lib64/libfftw_mpi.so: undefined reference to `__libm_sse2_sincos'
/usr/lib64/libfftw_mpi.so: undefined reference to `_intel_fast_memcpy'
collect2: ld returned 1 exit status

They are both easy to solve, just add this line to the LDFLAGS variable in the Makefile.

-L/opt/intel/fce/COMPILER_VERSION/lib -lirc -limf

The symbol __libm_sse2_sincos is provided by libimf.a while _intel_fast_memcpy is provided by libirc.a.The program should now link without missing symbols and you should have an executable file. Sometimes the order the linked libraries are set in LDFLAGS matters, so take that into consideration if it still fails or user an alternative to the GNU linker.

No comments:

Post a Comment