Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Novice
40 Views

matlab no longer working after installing mkl

Hi

I installed mkl_2018 on a linux Debian 8.0 64bits where I already had matlab installed. Before installing mkl, matlab worked fine.

Since I installed mkl, matlab starts but crashes with following error when I do a signal convolution:

Intel MKL FATAL ERROR: cannot load libmkl_avx.so

So I added 

export LD_PRELOAD=/opt/intel/mkl/lib/intel64/libmkl_avx.so to my .bashrc and sourced it, and now I can no longer launch matlab : I get following error message:

symbol lookup error: /opt/intel/mkl/lib/intel64/libmkl_avx.so: undefined symbol: mkl_parse_optimize_bsr_trsm_i8

Any idea ?

Thanks

0 Kudos
9 Replies
Highlighted
Employee
40 Views

Are you using Matlab with seperately installed MKL? Or use the default setting of Matlab?

0 Kudos
Highlighted
Novice
40 Views

How do I know which MKL Matlab is using ? I did not change any Matlab setting so I assume it is default setting.

0 Kudos
Highlighted
Moderator
40 Views

>> How do I know which MKL Matlab is using ? 

<< version -blas  or version -lapack

FYI:   the latest Matlab R2017b uses MKL 11.3.1 

>> version -date

ans =   'September 14, 2017'

>> version -blas 

ans =   'Intel(R) Math Kernel Library Version 11.3.1 Product Build 20151021 for Intel(R) 64 architecture applications, CNR branch AVX2

0 Kudos
Highlighted
Employee
40 Views

Could you share us a sample code that we can use to reproduce the error?

Alternatively, you may try "source mklvars.sh intel64/ia32" rather than set LD_PRELOAD before starting Matlab.

0 Kudos
Highlighted
Employee
40 Views

I tested on my Ubuntu 16.04 with Matlab 2016b with & without MKL 2018 installed.

>> version
ans =
9.1.0.441655 (R2016b)
>> version -date
ans =
September 7, 2016
>> version -blas
ans =
Intel(R) Math Kernel Library Version 11.3.1 Product Build 20151021 for Intel(R) 64 architecture applications, CNR branch AVX2
>> version -lapack
ans =
Intel(R) Math Kernel Library Version 11.3.1 Product Build 20151021 for Intel(R) 64 architecture applications, CNR branch AVX2
Linear Algebra PACKage Version 3.5.0

The default MKL lib that Matlab calls is MKL 11.3.1.

Also, I followed https://www.mathworks.com/help/matlab/matlab_external/calling-lapack-and-blas-functions-from-mex-files.html to try to call BLAS and LAPACK functions using Matlab samples.

>> copyfile(fullfile(matlabroot,'extern','examples','refbook','matrixMultiply.c'),'.')
>> fileattrib('matrixMultiply.c','+w')
>> mex -v matrixMultiply.c -lmwblas
>> A = [1 3 5; 2 4 7];
>> B = [-5 8 11; 3 9 21; 4 0 8];
>> X = matrixMultiply(A,B)
X =
    24    35   114
    30    52   162

>> copyfile(fullfile(matlabroot,'extern','examples','refbook','matrixDivide.c'),'.')
>> mex -v matrixDivide.c -lmwlapack
>> A = [1 2; 3 4];
>> B = [5; 6];
>> X = matrixDivide(A,B)
X =
   -4.0000
    4.5000

Could you follow these steps to check whether it works or not? Also, could you please check your Matlab version? Or please share your steps and matlab commands so that we can reproduce the error.

0 Kudos
Highlighted
Novice
40 Views

Hi Jing

I modified the LD_PRELOAD as follows in my .bashrc

export LD_PRELOAD=/opt/intel/mkl/lib/intel64/libmkl_core.so:/opt/intel/mkl/lib/intel64/libmkl_avx.so:/opt/intel/mkl/lib/intel64/libmkl_def.so:/opt/intel/mkl/lib/intel64/libmkl_gf_ilp64.so:/opt/intel/mkl/lib/intel64/libmkl_gf_lp64.so:/opt/intel/mkl/lib/intel64/libmkl_gnu_thread.so:/opt/intel/mkl/lib/intel64/libmkl_intel_ilp64.so

and now it works. I do not know what was the original MKL version my matalb was using and I cannot get it since I cannot launch but now I get:

>> version -blas

ans =

Intel(R) Math Kernel Library Version 2018.0.0 Product Build 20170720 for Intel(R) 64 architecture applications


>> version -lapack

ans =

Intel(R) Math Kernel Library Version 2018.0.0 Product Build 20170720 for Intel(R) 64 architecture applications
Linear Algebra PACKage Version 3.7.0

 

Running your mex example also works fine

Thanks 

 

Agks

 

 

0 Kudos
Highlighted
Employee
40 Views

Hi Agks,
Thanks for sharing for these useful info. We are having some further investigation, so we could understand why the problem happen there, and try to improve it for the future product release.

We need your help to provide some more information:  basically, we could not reproduce your problem at this moment, as Jing suggested before, we installed Matlab 2016b, and we also installed the latest MKL 2018 release. Both for them works well in a few our tests.

I also expect the MKL installation should not impact the Matlab at the system: Matlab includes some MKL BLAS and LAPACK functions in its installation, but all of functions were built into a new library ( mkl.so).  Intel MKL 2018 is installed into a different directory with different library names. So we do expect it will not bring the conflict there. The program does not need to set the LD_PRELOAD environment as well.

For your specific problem, could you help to provide some more info, which could help us to investigate this problem faster?
1)The matlab version you are using?    Also can you find the “mkl.so” file at the  MATLAB\version\bin\ARCH folder.

2)Do you set any environment to enforce the matlab to use your local MKL libraries ( for example mkl_rt.so).    Actually, Matlab provide some environment variable (BLAS_VERSION/ LAPACK_VERSION), which can change the Matlab MKL libraries.

If you are doing this, it needs to be careful here when you have a new version of MKL, you need to correctly set the path environment to new version of MKL.

3) Does your code directly program with MKL APIs, and linking with MKL?

Thanks,
Chao

0 Kudos
Highlighted
Novice
40 Views

Hi Chao

My answers below

1) R2014a

2) No

3)  No, just Matlab script

I remember I did not restart my computer after installing the MKL lib. Now I removed the LD_PRELOAD variable and Matlab works fine and is using the default MKL lib. Which leads me to the conclusion that I may have needed to restart the computer.

Thanks

 

agks

0 Kudos
Highlighted
Employee
40 Views

Could you share the name of the MKL installer? Did you download it from Intel website?

Please let me confirm the timeline.

1. Matlab worked well without errors.

2. Downloaded & Installed MKL.

Q1: Was Matlab running or closed when installing MKL?

Q2: Did you run Matlab and MKL installer in the same terminal? Or use different terminals (Like run Matlab in a terminal, and then start a new terminal and run MKL installer)?

Q3: Did MKL installer finish normally?

3. Matlab crashed with Intel MKL FATAL ERROR: cannot load libmkl_avx.so

Is this correct?

0 Kudos