Intel MKL 10.x Linking on Linux
1. Tips
To link with Intel MKL , you can choose pure layered model or the default model which is backward compatible on link line. (except cluster components).
- For the pure layered model, you need to choose one library from the Interface layer, one library from the Threading layer, the Computational layer library (no choice here), and add run-time libraries.
- In case of the default model, you need not change the link line (see the Dummy Libraries section for details).Dummy Library means its default links to some specified libraries. Like Dummy library libmkl.so contains references to following Intel MKL libraries
libmkl.so ==> lib/em64t/libmkl_intel_lp64.so,
lib/em64t/libmkl_intel_thread.so, and
lib/em64t/libmkl_core.so.
- In case of employing the pure layered model for static linking, the interface layer, threading layer, and computation layer libraries must be enclosed in grouping symbols, for example:
-Wl,–start-group -lmkl_intel_ilp64.a -lmkl_intel_thread.a -lmkl_core.a -Wl,–end-group
- ILP64 means 64 bit integer and LP means 32 bit integer
- ILP64 interface is provided for the following two reasons:
– To support huge data arrays (with more than 2 billion elements)
– To enable compiling your Fortran code with the -i8 compiler option.
-
The Intel Fortran Compiler supports the -i8 option for changing behavior of the INTEGERtype. By default the standard INTEGER type is 4-byte. The -i8 option makes the compiler treat INTEGER constants,
-
To bind your Fortran code with the ILP64 interface, you must compile your code with the -i8 compiler option. And vice-versa, if your code is compiled with -i8, you can bind it only with the ILP64 interface because the LP64 binary interface requires the INTEGER type to be 4-byte.
- For the languages of C/C++, Intel MKL provides the MKL_INT type as a counterpart of the INTEGER type for Fortran. MKL_INT is a macro defined as the standard C/C++ type int by default. However, if the MKL_ILP64 macro is defined for the code compilation, MKL_INT is defined as a 64-bit integer type. To define the MKL_ILP64 macro, you may call the compiler with the -DMKL_ILP64 command-line option.
2. References
- Link Line Compiler flags Advisor tool intel http://software.intel.com/sites/products/mkl/
- Details for linking the Intel MKL LIbraries http://software.intel.com/en-us/articles/intel-math-kernel-library-intel-mkl-for-linux-linking-applications-with-intel-mkl-version-100
- Lapack routines are merged into intel core and intel ilp library from 10.2 version so no need to link with the library libmkl_lapack.so for lapack linking however if one need lapack 95 interface that need too link with libmkl_lapack95_ilp64 http://software.intel.com/en-us/forums/topic/285931 http://r.789695.n4.nabble.com/Out-of-date-instructions-to-build-R-using-MKL-td4376544.html
- Error while linking Intel MKL threaded version and using -openmp option http://stackoverflow.com/questions/6482845/icc-on-linux-link-to-openmp
Thanks nisha. It helped a lot. 😀