1. Issue Description
MATLAB* is shipping specified version of Intel® Math Kernel Library(MKL) as BLAS and LAPACK library. For instance, the default MKL package for MATLAB2016b is MKL 11.3.1. If customer want to link with latest release of MKL (for example, MKL 2017 update 1). Customer need to set MATLAB variables for BLAS and LAPACK to the single dynamic library "MKL_rt.dll".
Some customer may meet program crash while calling some lapack/blas function after setting to new version of MKL. If you get a system error like below screenshot, please follow the resolution for this problem.
2. Reason
MATLAB* uses ILP64 library for interface layer, but MKL single dynamic library (mkl_rt.dll) loads LP64 type by default. Thus, you probably need to specify the interface layer for MKL to ILP64.
Here I make an example that people is going to link with MKL 2017 update 1. If you are using Linux* system, firstly please check if you already sourced root path for MKL.
> source /opt/intel/compilers_and_libraries_2017.1.132/linux/mkl/bin/mklvars.sh <intel64|ia32>
Then, set to link with latest version of MKL like following comments,
> export BLAS_VERSION=$MKLROOT/lib/intel64/libmkl_rt.so> export LAPACK_VERSION=$MKLROOT/lib/intel64/libmkl_rt.so> export MKL_INTERFACE_LAYER=ILP64
If you are using Windows* system, please open commend prompt for Intel compiler
> set BLAS_VERSION=mkl_rt.dll> set LAPACK_VERSION=mkl_rt.dll> set MKL_INTERFACE_LAYER=ILP64
4. Testing
Now you could launch your matlab in same terminal window for testing.
> matlab -desktop
Check if we set to link MKL 2017u1 successfully by type in command windows of MATLAB like below,
>> version -blas ans = Intel(R) Math Kernel Library Version 2017.0.1 Product Build 20161005 for Intel(R) 64 architecture applications, CNR branch AVX2>> version -lapack ans = Intel(R) Math Kernel Library Version 2017.0.1 Product Build 20161005 for Intel(R) 64 architecture applications, CNR branch AVX2 Linear Algebra PACKage Version 3.6.0
Test LU factorization function to check if MKL could be used without problem,
>>A=[1,2;3,4] A= 1 2 3 4>>[L,U]=lu(A) L = 0.3333 1.0000 1.0000 0 U = 3.0000 4.0000 0 0.6667
* You could learn more information about Using MKl with MATLAB from following links,
Using Intel® MKL with MATLAB*
Using Intel® Math Kernel Library with MathWorks* MATLAB* on Intel® Xeon Phi™ Coprocessor System