A New Linking Model-Single Dynamic Library mkl_rt Since Intel® MKL 10.3

Starting with Intel® MKL 10.3, there is a new dynamic library - the Single Dynamic Library interface (SDL interface) mkl_rt library was introduced. What is that? This article describes what is the SDL and how it can actually do for you.

Single Dynamic Library (SDL)

 

Files

Notes

Windows*

mkl_rt.lib & mkl_rt.dll

Single Dynamic Library interface library & Single Dynamic Library

Linux and MacOS*

libmkl_rt.so

Single Dynamic Library

 

The runtime single dynamic libraries (SDL) library was introduced originally for solving the declared issue related to the processor specific libraries not getting loaded when dlopen(RTLD_GLOBAL) was called.  The typical error message is

MKL FATAL ERROR: Cannot load neither libmkl_mc3.so nor libmkl_def.so

The single library is added allowing user to link to a single interface library which loads dependent libraries dynamically at runtime depending on runtime CPU detection and/or library function calls.

So the custom dynamic libraries builder in current version used it by default on the Linux* and Mac OS* X operating systems.

Besides resolving the load issue, the SDL actually brings some other benefits:

•1. A new linking model, make linking simpler

Generally, to link with Intel® Math Kernel Library (Intel® MKL), you may need to choose one library from the Interface layer and one library from the Threading layer and add the only library from the Computational layer and run-time libraries (RTL). See MKL Link Line Advisor

Alternatively, the Single Dynamic Library (SDL) does most of this for you and makes linking even simpler.

For example, dynamic linking of myprog.cpp and parallel Intel MKL supporting the cdecl interface under Windows IA32:

>cl myprog.cpp mkl_intel_c_dll.lib mkl_intel_thread_dll.lib mkl_core_dll.lib libiomp5md.lib

To use SDL library, put only one library in link line

>cl myprog.cpp mkl_rt.lib libiomp5md.lib

For details, please read mkl user guide:  Using the Single Dynamic Library Interface

•2. Enables you to select the interface and threading layer dynamically

Setting the Threading Layer at use the mkl_set_threading_layer function or the MKL_THREADING_LAYER environment variable.

To set one of these interfaces at run time, use the mkl_set_interface_layer function or the MKL_INTERFACE_LAYER environment variable when based on the Intel® 64 architecture

For example

mkl_set_interface_layer(MKL_INTERFACE_LP64)

mkl_set_threading_layer(MKL_THREADING_SEQUENTIAL);

for sequential library and LP 64 interface.

Please take a look at this KB article Using the Intel® MKL Dynamic Interface for Windows OS for more details about new optional linking model.

•3. Support third-party application and language like C#, Java, Python better

Dynamic interface libraries have been added in Intel MKL 10.3 for improved linkage from C#. It is not required to build a custom DLL. The Intel MKL library named mkl_rt.dll can be called directly from C# code

A example is in /en-us/articles/using-intel-mkl-in-your-c-program

It is same for python program. Using SDL directly removes the need to create your own custom library. Please see the article /en-us/articles/using-intel-mkl-in-your-python-program

For third-party application which have used previous mkl version, like have some link lines

-lmkl_em64t

And get the error like: libmkl_em64t can't be found

You can change them to -lmkl_rt as replacement. It includes all mkl routines declaration

SDL Known Issues

undefined symbol: omp_get_num_procs
from http://software.intel.com/en-us/forums/showthread.php?t=83364
Cause: The MKL loader located in libmkl_rt.so doesn't try to load libiomp5 library in previous MKL 10.3.x version and the problem is fixed since MKL 10.3.6.
Solution: build custom dll via custom dll builder tool or upgrade to latest MKL version (at least MKL 10.3.6)

SDL-Interface under x64 crashes

from http://software.intel.com/en-us/forums/showthread.php?t=80451
Solution: require the related MKL dlls (e.g. libimalloc mkl_mc3 mkl_core mkl_intel_thread) in the PATH

/en-us/forums/showthread.php

/en-us/forums/showthread.php

/en-us/forums/showthread.php

Reference

How do I use Intel® MKL with Java*?
Using Intel® MKL in your C# program
Some more additional tips "How to call KL from your C# code"
Using Intel® MKL in your Python program
Intel® MKL and Third Party Application How to Use them together
Using the Intel® MKL Dynamic Interface for Windows OS
Linking Applications With Intel® MKL Version 10.0
MKL Link Line Advisor

For more complete information about compiler optimizations, see our Optimization Notice.