| January 19, 2010 9:00 PM PST | |
In order to provide maximum support for our users, we re-architected Intel® MKL since MKL 10.0. This new Intel® MKL architecture provides 4 layer libraries so that users can choose numerous linking combinations according to the wanted configurations of interfaces, compilers, and threading mode. But some users who used to previous MKL version may be confused by this change.
The following are some tips for easily migrating from 9.x to 10.x MKL.
For who begin from MKL 10.0 and want to learn how to use it, please refer to the Intel® MKL User's Guide or online help Linking applications with Intel® MKL version 10.0 and click the straightforward tool:
Intel® Math Kernel Library Link Line Advisor
First, please know all new libraries are physically separated into 4 layers in MKL 10:
1. Interface layer
2. Threading layer
3. Computation layer
4. Compiler Support RTL layer (RTL layer, for brevity)
In addition, the new link command is required to select only one library to link from each layer. For example, general required libraries are as follows:
mkl_intel_c.lib mkl_intel_thread.lib mkl_core.lib libiomp5md.lib
We call this kind of link mode as layered mode
Please refer to Intel® MKL User's Guide for more details.
MKL 10.x also includes dummy libraries to provide backward compatibility with earlier versions, such as mkl_c.lib,mkl_c_dll.lib. These dummy libraries will be removed in the future release. You are strongly encouraged to link Intel MKL with layered mode.
Windows*
Linux*
Mac OS*
Dummy Libraries Table
Windows*
If you have used earlier version of MKL for windows* and decide to migrate from previous version to MKL 10.x, please refer to the following steps:
1. Add MKL 10.x executable path in SYSTEM environment.
2. Open My Computer » System Properties » Advanced » Environment Variables » System variables » Path » Edit.
Remove the executable path of previous MKL and add MKL 10.x's (e.g., default: remove the C:\Program Files\Intel\MKL\9.0\ia32\bin, and add C:\Program Files\Intel\MKL\10.x.x.xxx\ia32\bin).
3. Add MKL 10.x header file INCLUDE path in your compiler command line, your makefile or configure file or in MSVC IDE. Please refer to mkl User Guide: Compiling and Linking with Microsoft* Visual C/C++*.
(e.g., default: remove the C:\Program Files\Intel\MKL\9.0\include, and
add C:\Program Files\Intel\MKL\10.x.x.xxx\include).
4. Add MKL 10.x library files in LIBRARY path in your compiler command line, your makefile or configure file or in MSVC IDE.
(e.g. default: remove the C:\Program Files\Intel\MKL\9.0\ia32\lib, and add C:\Program Files\Intel\MKL\10.x.x.xxx\ia32\lib).
5. Specify the corresponding libraries in your compiler command line, your makefile or configure file or in MSVC IDE.
For static linkage, add the libraries:
mkl_intel_c.lib mkl_intel_thread.lib mkl_core.lib libiomp5md.lib
For dynamic linkage, add the libraries:
mkl_intel_c_dll.lib mkl_intel_thread_dll.lib mkl_core_dll.lib libiomp5md.lib
For selecting which libraries to link, please refer to chapter 5 of Intel® MKL User's Guide.
Note 1: libiomp5md.lib (or libiomp5mt.lib) is required.
Note 1a: There can be compatibilities problems when Intel MKL 10.x and any previous versions of Intel MKL are both simultaneously found installed on a system (both libraries on the PATH variable). If you are experiencing problems related to the Intel MKL threading runtime library or libimalloc we suggest you uninstall or remove the unused version from the PATH.
If you have used earlier version of Intel MKL for Linux* and decide to migrate from previous version to MKL 10.x, please refer to the following steps:
1. Add MKL 10.x header file INCLUDE path in your compiler command line, your makefile or configure file. (default: /opt/intel/mkl/10.x.x.xxx/include)
2. Add MKL 10.x library path in your compiler command line, your makefile or configure file. (default: /opt/intel/mkl/10.x.x.xxx/lib/32)
3. Specify the corresponding libraries in your compiler command line, your makefile or configure file.
With static link, they are as follows:
-Wl,--start-group
/opt/intel/mkl/10.0.xxx/lib/32/libmkl_intel.a
/opt/intel/mkl/10.0.xxx/lib/32/libmkl_intel_thread.a
/opt/intel/mkl/10.0.xxx/lib/32/libmkl_core.a
Wl,--end-group
/opt/intel/mkl/10.0.xxx/lib/32/libiomp5md.so -lpthread -lm
With dynamic link,
-L/opt/intel/mkl/10.0.xxx/lib/32/ they are
-lmkl_intel.so -lmkl_intel_thread.so -lmkl_core.so [-liomp5md]
[-lpthread] [-lm]
Note 2: In case of using static linking, the interface layer, threading layer, and computation layer libraries must be enclosed in grouping symbols (<-Wl,--start-group, -Wl,--end-group).
Note 3: Specifying MKL library path in the link command line is required. For example, -L/opt/intel/mkl/10.x.xxx/lib/32, so that the linker can search for real archive libraries.
Note 4: The order of listing libraries in the link line is essential, except for the libraries enclosed in the grouping symbols.
Please refer to chapter 5 of Intel® MKL User's Guide or online help Linking applications with Intel® MKL version 10.0 for more information.
4. Set MKL library path to LD_LIBRARY_PATH environment variable before running application, e.g.,#export LD_LIBRARY_PATH=/opt/intel/mkl/10.x.x.xxx/lib/32:$LD_LIBRARY_PATH
If you have used earlier version of Intel MKL for Mac OS* and decide to migrate from previous version to MKL 10.x, please refer to the following steps:
1. Add MKL 10.x header file INCLUDE path in your compiler command line, your makefile or configure file, or the Apple* Xcode*development environment. (default: MKLINCLUDE= /Library/Frameworks/Intel_MKL.framework/Headers)
2. Add MKL 10.x library search path in your compiler command line, your makefile or configure file, or the Apple* Xcode*development environment. (default: MKLPATH =/Library/Frameworks/Intel_MKL.framework/Versions/10.x.x.xxx/lib/32)
3. Specify the libraries in your compiler command line, your makefile or configure file or the Apple* Xcode* development environment.
Please note, MKL 10.x for Mac OS only supports layered pure mode. For example, with static link, they are as follows:
$MKLPATH/libmkl_intel.a $MKLPATH/libmkl_intel_thread.a
$MKLPATH/libmkl_core.a
$MKLPATH/libmkl_intel.a $MKLPATH/libmkl_intel_thread.a
$MKLPATH/libmkl_core.a
$MKLPATH/libmkl_intel.a $MKLPATH/libmkl_intel_thread.a
$MKLPATH/libmkl_core.a
-liomp5md -lpthread
With dynamic link, they are as follows:
-L$MKLPATH -lmkl_intel -lmkl_intel_thread -lmkl_core -liomp5md -lpthread
Note 5: For static linking, the interface layer, threading layer, and computation layer libraries (for example, libmkl_intel.a libmkl_intel_thread.a libmkl_core.a) must be repeated two times for all components except BLAS and FFT. For the LAPACK component, threading layer and computation layer libraries must be repeated three times.
Note 6: For static linking, specifying MKL library path in the link line like $MKLPATH/libmkl_core.a is required as both shared and static library have the same names in MKL 10.x.
Note 7: The libraries under "32" folder is used for 32-bit applications.
The libraries under "em64t" folder is or Intel® Xeon® processor using Intel® 64 architecture.
4. Set MKL library path to the following environment variables before running application. For example:
export MANPATH=/Library/Frameworks/Intel_MKL.framework/Versions/10.x.x.xxx/man:$MANPATH
export DYLD_LIBRARY_PATH=/Library/Frameworks/Intel_MKL.framework/Versions/10.x.x.xxx/lib/32:$DYLD_LIBRARY_PATH
export LIBRARY_PATH=/Library/Frameworks/Intel_MKL.framework/Versions/10.x.x.xxx/lib/32:$LIBRARY_PATH
Linking Examples
Below are some specific examples for linking based on Intel 32 architecture. For linking example based on Intel 64 architecture, please see the samples in Intel® MKL User's Guide
For instance, you want to use the MKL versions of BLAS, LAPACK, FFT and PARDISO in MKL 9.x, the libraries you were using are:
mkl_solver.lib mkl_c_dll.lib libguide40.lib (Windows*)
-lmkl_solver -lmkl_lapack -lmkl_ia32 -lguide -lpthread -lm.(Linux)
-lmkl_solver -lmkl_lapack -lmkl_ia32 -lguide -lpthread -lm (Mac OS)
To change into layered library in MKL 10.x, the required libraries are:
mkl_intel_c_dll.lib mkl_intel_thread_dll.lib mkl_core_dll.lib libiomp5md.lib (Windows*)
-lmkl_intel -lmkl_intel_thread -lmkl_core -lmkl_solver -liomp5md -lpthread -lm (Linux)
-lmkl_intel -lmkl_intel_thread -lmkl_core -lmkl_solver -liomp5md -lpthread -lm (Mac OS)
MKL Dummy Libraries Table
MKL 10.x includes dummy libraries to provide backward compatibility with earlier versions, such as mkl_c.lib,mkl_c_dll.lib. These dummy libraries will be removed in the future release. You are strongly encouraged to link Intel MKL with layered mode.
To replace MKL dummy libraries with new layered libraris, users can refer to the following table:
|
|
MKL dummy library |
Replacement in layered libraries |
|
IA32 |
mkl_c_dll.lib |
mkl_intel_c_dll.lib mkl_intel_thread_dll.lib mkl_core_dll.lib |
|
mkl_s_dll.lib |
mkl_intel_s_dll.lib mkl_intel_thread_dll.lib mkl_core_dll.lib |
|
|
mkl_c.lib |
mkl_intel_c.lib mkl_intel_thread.lib mkl_core.lib |
|
|
mkl_s.lib |
mkl_intel_s.lib mkl_intel_thread.lib mkl_core.lib |
|
|
mkl_scalapack_dll.lib |
mkl_scalapack_core_dll.lib |
|
|
mkl_scalapack.lib |
mkl_scalapack_core.lib |
|
|
mkl_cdft_dll.lib |
mkl_cdft_core_dll.lib |
|
|
mkl_cdft.lib |
mkl_cdft_core.lib |
|
|
Intel 64 |
mkl_dll.lib |
mkl_intel_lp64_dll.lib mkl_intel_thread_dll.lib mkl_core_dll.lib |
|
mkl_em64t.lib |
mkl_intel_lp64.lib mkl_intel_thread.lib mkl_core.lib.lib |
|
|
mkl_scalapack_dll.lib |
mkl_scalapack_lp64_dll.lib |
|
|
mkl_scalapack.lib |
mkl_scalapack_lp64.lib |
|
|
mkl_solver.lib |
mkl_scalapack_lp64.lib |
|
|
mkl_cdft_dll.lib |
mkl_cdft_core_dll.lib |
|
|
mkl_cdft.lib |
mkl_cdft_core.lib |
|
|
Itanium |
mkl_dll.lib |
mkl_intel_lp64_dll.lib mkl_intel_thread_dll.lib mkl_core_dll.lib |
|
mkl_ipf.lib |
mkl_intel_lp64.lib mkl_intel_thread.lib mkl_core.lib |
|
|
mkl_scalapack_dll.lib |
mkl_scalapack_lp64_dll.lib |
|
|
mkl_scalapack.lib |
mkl_scalapack_lp64.lib |
|
|
mkl_solver.lib |
mkl_scalapack_lp64.lib |
|
|
mkl_cdft_dll.lib |
mkl_cdft_core_dll.lib |
|
|
mkl_cdft.lib |
mkl_cdft_core.lib |
Note 8: The dummy library will be removed since MKL 10.2
Note 9: The table applys for windows. It also pertains to Linux/Mac OS, just change the name of library like libmkl_em64t.a/libmkl_em64t.so
This article applies to: Intel® Math Kernel Library Knowledge Base
For more complete information about compiler optimizations, see our Optimization Notice.
Comments (1) 
Trackbacks (1)
- Install:Intel C++ Composer XE & Intel Math Kernel Library | 秦羽捷 ( Yujie QIN )'s Blog
January 25, 2011 5:23 PM PST



Vipin Kumar E K (Intel)
6,291
http://software.intel.com/en-us/articles/intel-mkl-link-line-advisor/
--Vipin