rawpointer
rawpointer

Reputation: 105

How to locate and link with the exact same Intel MKL that MATLAB is shipped with?

The question in the header summarizes what I aim to achieve, which is more precisely detailed as below.

The goal is to compile C++ based mex files that rely on Intel MKL function calls (e.g. matrix inverse calculation).

In order to do so, I would like to ensure that I use the exact same Intel MKL libraries which MATLAB is shipped with, so as to avoid any compatibility issues. In this particular case, this is:

>> version('-blas')

ans =

    'Intel(R) Math Kernel Library Version 2018.0.3 Product Build 20180406 for Intel(R) 64 architecture applications, CNR branch AVX
     '

>> version('-lapack')

ans =

    'Intel(R) Math Kernel Library Version 2018.0.3 Product Build 20180406 for Intel(R) 64 architecture applications, CNR branch AVX
     Linear Algebra PACKage Version 3.7.0
     '

Warning: the above Intel MKL BLAS & LAPACK are not the same as the ones that are available for download from Intel’s official website. The latter ones I would prefer not to use for the above-mentioned potential compatibility reasons.

In which MATLAB folder(s) are the above reference static/dynamic Intel MKL libraries are located?

I have extensively searched after them in the many MATLAB folders, but I unfortunately could not find them. It seems that they are ‘buried’ somewhere deep in MATLAB.

How is it possible to do this at all?

My setup: Windows 10, MATLAB R2091b, Intel MKL.

I am very grateful for any help. Thank you in advance.

Upvotes: 1

Views: 468

Answers (1)

James Tursa
James Tursa

Reputation: 2636

On my Win64 machine I find them here

[matlabroot '/extern/lib/win64/microsoft']

and here

[matlabroot '/extern/lib/win64/mingw64']

The BLAS library is named libmwblas.lib, and the LAPACK library is named libmwlapack.lib

For reference, note that in R2007a and earlier, The Mathworks shipped the BLAS and LAPACK libraries as a single combined library. They weren't shipped as two separate libraries until R2007b and later.

Upvotes: 1

Related Questions