Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.
7222 Discussions

MKL DFT with Matlab MEX application: environment variable needed

mbackues
Beginner
1,452 Views
Hello. I'm trying to use MKL DFT's in a MEX application. I recall from a few years backthat there's an environment variable that needs to be set, but I don't remember the reasonor exactly what it is, and can't find it online. Without it,Matlab crashes during the FFT plan creation. If someone can remind me what the variable is, I would appreciate it. I am using Matlab 7 and MKL 10.
0 Kudos
6 Replies
Dmitry_B_Intel
Employee
1,452 Views

Hi. Was the variable related to memory management or threading? MKL User's Guide is the place where to look for environment variables, particularly section 6.

Thanks,
Dima

0 Kudos
mbackues
Beginner
1,452 Views
Thanks, no, its not one of those threading or memory management environment variables. Its a patch for some kind of incompatibility betweenthe MKL DFT library and MEX libraries. Apparently Matlab isn't high enough on Intel's radar forMEX usebe tested and supported, and vice versa, so its not in the documentation. I don't remember how I found out aboutit before.
0 Kudos
mbackues
Beginner
1,452 Views
OK, I have more information....the problem is that Matlab now uses MKL, so the need is to set the environment so that the MEX application can also link in MKL without a conflict. Still don't know how to do that though.
0 Kudos
Todd_R_Intel
Employee
1,452 Views
I'm afraid I don't know. Do you remember if it was an MKL or Matlab variable?

Anybody on the forum familiar with this variable for use of MKL with Matlab?
0 Kudos
rbarron
New Contributor I
1,452 Views

I suggest you post your question on Mathworks forum,

http://www.mathworks.com/matlabcentral/newsreader/

but first do a search on MKL.

0 Kudos
AndrewC
New Contributor III
1,452 Views
The problem is probably that Matlab 7 uses MKL 9.x... and if your MEX DLL uses MKL 10.0 you will crash as there are a number of conflicts. When running in Matlab the ./bin directory ( with the MKL 9.x DLL's) is always first in the PATH.

I have battled with this for some time. There are a couple of solutions however.

1) Link MKL statically into your MEX DLL.

2) Build a 'custom' MKL DLL following the instructions in the MKL documentation, and link your MEX DLL against that. That way, your MEX DLL can load the custom MKL DLL and Matlab will load it's MKL DLL's and there is no longer any conflict.

0 Kudos
Reply