The article describes various types of linkage models offering in Intel® Math Kernel Library (Intel MKL) and which Intel MKL libraries are required to be distributed by developers with applications.
Overview
The Intel® MKL libraries are organized by three types of library files:
Note: The table addressed the 32bit windows libraries. Developers can extend them to intel64, cluster, linux* correspondingly. |
Linkage Models and Example
These libraries offer various linkage models for different needs. The following are the typical four linkage models supported by the Intel® MKL:
Dynamic linkage | icl myprog.c mkl_intel_c_dll.lib mkl_intel_thread_dll.lib mkl_core_dll.lib libiomp5md.lib |
Static linkage | ifort myprog.f mkl_intel_c.lib mkl_intel_thread.lib mkl_core.lib libiomp5md.lib |
SDL linkage | cl myprog.c mkl_rt.lib |
Custom dynamic linkage | First build custom dynamic library: mkl_custom.dll from mkl\tools\builder |
Note: libiomp5md.lib and libiomp5md.dll are required when threading MKL libraries are linked. They are the OpenMP Runtime library, located in [install-dir]\compiler\lib\32 and [install-dir]\redist\ia32\compiler respectively.
Above are some explicit link examples. Please read Intel MKL user guide for more details about Custom Dynamic library and SDL linkage model at section:
- Using the Single Dynamic Library
- Dynamically Selecting the Interface and Threading Layer- Building Custom Dynamic-link Libraries
Moreover, Intel® MKL provides several options for quick linking of your application. The simplest options depend on your development environment, like Intel MKL user guide section:
-Using the Qmkl Compiler Option
- Automatically Linking a Project in the Visual Studio* Integrated Development -Environment with Intel® MKL
-Using the Link-line Advisor
Quick comparison of the four linkage models
|
Distribution Notes
As above table shows, dynamic linkage and SDL linkage are required to distribute the linked MKL dlls and processor-specific dlls with users’ application. Usually, in order to support different types of processors, we recommend distributing all of dlls located in [install-dir]\redist\ia32\mkl\.
For example,
| Link line | Distributed dll |
Dynamic linkage | icl myprog.c mkl_intel_c_dll.lib mkl_intel_thread_dll.lib mkl_core_dll.lib libiomp5md.lib | mkl_intel_thread.dll |
SDL linkage | cl myprog.c mkl_rt.lib | mkl_rt.dll |
+libiomp5md.dll is from redist\ia32\compiler folder
+static linkage and custom linkage don’t require extra Intel MKL library distribution. But if building with threaded library, libiomp5md.dll is required.
Processor-specific dll: Sometimes, in order to distribute a smaller application for special type of processor, user can distribute only the processor- specific optimized dll other than all processor-specific dlls under redist\ia32\mkl.
For example, mentioned in Intel MKL forum thread U517954, user only call PARDISO* function on the processor supporting Intel® Advanced Vector Extensions 2 (Intel® AVX) instruction, then user can distribute the below 5 dlls:
mkl_rt.dll, mkl_intel_thread.dll, mkl_avx2.dll mkl_core.dll libiomp5md.dll
+mkl_avx2.dll: Kernel optimized for Intel® Advanced Vector Extensions 2 (Intel® AVX).
Note: There are several non-processor-specific dlls, they are required only when used
libimalloc.dll | Dynamic library to support renaming of memory functions |
1033\mkl_msg.dll | Catalog of Intel® Math Kernel Library (Intel® MKL) messages in English |
Dynamic dll vs. Custom dll: In order to distribute a small application, the custom dll is recommended too. For example, mentioned in another MKL forum thread U517950, user is calling Pardiso and Dfeast functions. Normally, user needs to distribute the mkl_intel_thread.dll, mkl_core.dll, libiomp5md.dll and all processor-specific dlls with their application. In order to reproduce the redistribution size, the user can build custom.dll only including PARIDSO and DEFAST function based on Intel MKL custom dll builder. Then they can only distribute his application and the cutom.dll (+libiomp5md.dll). No Intel MKL library is needed.
If you're still having trouble on library linkage and distribution, you might check the reference documentation. Another option is to search the Intel MKL forum for other reports of a similar problem or post a question of your own.
Reference: