Linking applications with Intel® MKL version 10.x

Linking model change

In versions 10.x of Intel® MKL, we have re-architected Intel MKL and physically separated the interface, threading and computational components of the product. This architecture facilitates the use of multiple library linking combinations to support numerous configurations of interfaces, compilers, and processors in a single package. Multiple layers are provided so that the base Intel MKL package supports numerous configurations of interfaces, compilers, and processors in a single package.

This new Intel MKL architecture is intended to provide maximum support for our varied customers’ needs, while minimizing the effort it takes to obtain and utilize the great performance of Intel MKL. For more information, please refer to the "Using Intel® MKL Parallelism" section of the Intel® MKL User’s Guide.

Key libraries within each component layer

Interfaces
  • LP64 / ILP64 (32 / 64-bit integers)
  • Intel or gfortran function
  • SP2DP: single precision BLAS functions with 64-bit floating point parameters
Threading
  • Use the Intel, Gnu, or PGI threading libraries
  • Sequential version contains no thread library dependencies
Computation
  • Use a single computation library for all interfaces and threading layers, as there is no parallelism in the computation layer
Runtime
  • The Intel® compiler threading runtime
  • Support for multiple MPI implementations

Example of link files

Layer 64-bit Linux, Intel® 64
Interfaces libmkl_intel_ilp64.a
libmkl_intel_lp64.a
libmkl_intel_sp2dp.a
libmkl_gf_ilp64.a
libmkl_gf_lp64.a
Threading libmkl_intel_thread.a
libmkl_gnu_thread.a
libmkl_pgi_thread.a
libmkl_ sequential _thread.a
Computation libmkl_core.a
libmkl_em64t.a  //Dropped since v10.2.x
libmkl_lapack.a  //Droppped since v10.2.x
libmkl_solver.a  // Dropped since v10.2.x
libmkl_solver_lp64.a
libmkl_solver_ilp64.a
libmkl_scalapack.a
libmkl_scalapack_core.a
libmkl_cdft.a
libmkl_cdft_core.a
Runtime libguide.a
libmkl_blacs_intelmpi.a
libmkl_blacs_intelmpi20.a
libmkl_blacs_op enmpi.a

Link command syntax

To link with the Intel MKL libraries, follow this general form of specifying paths and libraries in the link line:
-L<MKL path> -I<MKL include>
[-lmkl_lapack95] [-lmkl_blas95]
[cluster components]
[-Wl,--start-group]
[{-lmkl_{intel, intel_ilp64, intel_lp64, intel_sp2dp, gf, gf_ilp64, gf_lp64}]
[-lmkl_{intel_thread, sequential}]
[{-lmkl_solver, -lmkl_solver_lp64, -lmkl_solver_ilp64}]
{{[-lmkl_lapack] -lmkl_{ia32, em64t, ipf}},
-lmkl_core}}
[-Wl,--end-group]
[{-lguide, -liomp5}] [-lpthread] [-lm]

Note: Select only one library to link from each group in side the {} as needed.

To link with Intel MKL, you can choose pure layered model or default model, which is backward compatible on link line (except cluster components). The syntax above incorporates both models. 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 in chapter 3 for details).

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).

In case you use dummy libraries --

  • The path to Intel MKL libraries must be added to the list of paths that the linker will search for archive libraries (for example, as -L<MKL path>).
  • No interface layer or threading layer libraries should be included in the link line.
  • No grouping symbols should be employed.

The order of listing libraries in the link line is essential, except for the libraries enclosed in the grouping symbols.

Selecting libraries to link

Below are several simple examples of link libraries for the layered pure and layered default link models on 64-bit Linux* based on Intel 64 architecture for different components using Intel compiler interface.

  • BLAS, FFT, VML, VSL components, static case:
    Layered default: libmkl_em64t.a
    Layered pure: libmkl_intel_lp64.a libmkl_intel_thread.a libmkl_core.a
  • BLAS, FFT, VML, VSL components, dynamic case:
    Layered default: libmkl.so
    Layered pure: libmkl_intel_lp64.so libmkl_intel_thread.so libmkl_core.so
  • LAPACK, static case:
    Layered default: libmkl_lapack.a libmkl_em64t.a
    Layered pure: libmkl_intel_lp64.a libmkl_intel_thread.a libmkl_core.a
  • LAPACK, dynamic case:
    Layered default:libmkl_lapack.so libmkl.so
    Layered pure: libmkl_intel_lp64.so libmkl_intel_thread.so libmkl_core.so
  • ScaLAPACK, static case:
    Layered default: libmkl_scalapack.a libmkl_blacs.a libmkl_lapack.a
    libmkl_em64t.a
  • Layered pure:
    libmkl_intel_lp64.a libmkl_scalapack_core.a
    libmkl_blacs.a libmkl_intel_thread.a libmkl_core.a
  • PARDISO, static case:
    Layered default: libmkl_solver.a libmkl_lapack.a libmkl_em64t.a
    Layered pure, LP64: libmkl_solver_lp64.a libmkl_intel_lp64.a
    libmkl_intel_thread.a libmkl_core.a
  • Layered pure, ILP64:
    libmkl_solver_ilp64.a libmkl_intel_ilp64.a
    libmkl_intel_thread.a libmkl_core.a

Linking examples

Below are some specific examples for linking using Intel compilers on systems based on Intel 64 architecture. In these examples, <MKL path> and <MKL include> placeholders are replaced with user-defined environment variables $MKLPATH and $MKLINCLUDE, respectively. See also examples on linking with ScaLAPACK and Cluster FFT in User’s Guide chapter 9.

ifort myprog.f -L$MKLPATH -I$MKLINCLUDE
-Wl,--start-group -lmkl_intel_lp64.a -lmkl_intel_thread.a -lmkl_core.a
-l-l-l-Wl,--end-group -lguide -lpthread
static linking of user code myprog.f and parallel Intel MKL supporting LP64 interface.
ifort myprog.f -L$MKLPATH -I$MKLINCLUDE
-lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -lguide -lpthread
dynamic linking of user code myprog.f and parallel Intel MKL supporting LP64
interface.
ifort myprog.f -L$MKLPATH -I$MKLINCLUDE
-Wl,--start-group -lmkl_intel_lp64.a -lmkl_sequential.a
-lmkl_core.a-l-l-l -Wl,--end-group -lpthread
static linking of user code myprog.f and sequential version of Intel MKL supporting
LP64 interface.
ifort myprog.f -L$MKLPATH -I$MKLINCLUDE
-lmkl_intel_lp64 -lmkl_sequential -lmkl_core -lpthread
dynamic linking of user code myprog.f and sequential version of Intel MKL supporting
LP64 interface.
ifort myprog.f -L$MKLPATH -I$MKLINCLUDE
-Wl,--start-group -lmkl_intel_ilp64.a -lmkl_intel_thread.a -lmkl_core.a
-l-l-l-Wl,--end-group -lguide -lpthread
static linking of user code myprog.f and parallel Intel MKL supporting ILP64 interface.
ifort myprog.f -L$MKLPATH -I$MKLINCLUDE
-lmkl_intel_ilp64 -lmkl_intel_thread -lmkl_core -lguide -lpthread
dynamic linking of user code myprog.f and parallel Intel MKL supporting ILP64
interface.
ifort myprog.f -L$MKLPATH -I$MKLINCLUDE -lmkl_lapack95
-Wl,--start-group -lmkl_intel_lp64.a -lmkl_intel_thread.a -lmkl_core.a
-l-l-l-l-Wl,--end-group -lguide -lpthread
static linking of user code myprog.f, Fortran 95 LAPACK interface1, and parallel Intel
MKL supporting LP64 interface.
ifort myprog.f -L$MKLPATH -I$MKLINCLUDE -lmkl_blas95
-Wl,--start-group -lmkl_intel_lp64.a -lmkl_intel_thread.a -lmkl_core.a
-l-l-l-Wl,--end-group -lguide -lpthread
static linking of user code myprog.f, Fortran 95 BLAS interface1, and parallel Intel
MKL supporting LP64 interface.
ifort myprog.f -L$MKLPATH -I$MKLINCLUDE -lmkl_solver_lp64.a
-Wl,--start-group -lmkl_intel_lp64.a -lmkl_intel_thread.a -lmkl_core.a
-l-l-l-Wl,--end-group -lguide -lpthread
static linking of user code myprog.f, parallel version of sparse solver, and parallel Intel
MKL supporting LP64 interface.
ifort myprog.f -L$MKLPATH -I$MKLINCLUDE -lmkl_solver_lp64_sequential.a
-Wl,--start-group -lmkl_intel_lp64.a -lmkl_sequential.a
-lmkl_core.a-l-l-l -Wl,--end-group -lpthread
static linking of user code myprog.f, sequential version of sparse solver, and
sequential Intel MKL supporting LP64 interface.

Operating System:

Red Hat* Linux, Red Hat* Desktop Linux* 3, Red Hat* Enterprise Linux Desktop 4, Red Hat* Desktop 3 Update 4, Red Hat* Enterprise Linux Desktop 3 Update 3, Red Hat* Enterprise Linux Desktop 3 Update 4, Red Hat* Enterprise Linux Desktop 3 Update 5, Red Hat* Enterprise Linux Desktop 4 Update 1, Red Hat* Enterprise Linux 2.1, SUSE* Linux 9.1, SUSE* Linux Enterprise Server 8.0, SUSE* Linux Enterprise Server 9.0, Red Hat* Enterprise Linux 4.0, Redhat* Desktop 3 Update 5, Redhat* Desktop 3 Update 6, Redhat* Desktop 3 Update 7, Redhat* Desktop 4 Update 2, Redhat* Desktop 4 Update 3, Redhat* Desktop 4 Update 4, SuSE* Linux* Enterprise* Desktop 10, SUSE* Linux Enterprise Server 10, Red Hat* Enterprise Linux 5.0, Red Hat* Linux 6.2, Red Hat* Linux 6.2 SBE2, Red Hat* Linux 7.0, Red Hat* Linux 7.1, Red Hat* Linux 7.2, Red Hat* Linux 7.3, SUSE* Linux 7.3, SUSE* Linux 8.0, SUSE* Linux 8.1, Red Hat* Linux 8.0, SUSE* Linux 7.2, SUSE* Linux 7.1, SUSE* Linux 7.0, SUSE* Linux, Red Hat* Linux Advanced Server 2.x, Red Hat* Linux 9.0, Red Hat* Enterprise Linux 3.0, SUSE* Linux* 8.2, Red Hat* Linux Advanced Server 3.x, SUSE* Linux* 9.x
 
For more complete information about compiler optimizations, see our Optimization Notice.

Comments

Please refer the Intel MKL linking advisor tool from below url for identifying which libraries to link from MKL.

http://software.intel.com/en-us/articles/intel-mkl-link-line-advisor/

--Vipin




I also find that the libmkl_em64t.a seems to be missing from version 10.2.1.017.
How did we to go???



while I tried to compile VASP in parallel it showed the error

/home/jindal1/intel/mkl/10.0.5.025/lib/em64t/libfftw3xf_intel.a(tt_fftw_in_to_out.o): In function `tt_fftw_in_to_out':
wrappers/tt_fftw_in_to_out.c:(.text+0x51): undefined reference to `_intel_fast_memcpy'
/home/jindal1/intel/mkl/10.0.5.025/lib/em64t/libfftw3xf_intel.a(tt_fftw_norm.o): In function `tt_fftw_norm':
wrappers/tt_fftw_norm.c:(.text+0x91): undefined reference to `_intel_fast_memcpy'
collect2: ld returned 1 exit status
make: *** [vasp] Error 1

what can be it due to? Plz help me.