5

I have a MATLAB subscription and I have read that MATLAB uses Intel MKL libraries but I am not sure where to locate all the DLLs / files corresponding to the Intel MKL libraries. I could find any mention of their location in the documentation.

Thanks

uday
  • 6,453
  • 13
  • 56
  • 94

1 Answers1

3

You will find the library at [matlabroot]\bin\ARCH\mkl.dll (e.g. C:\Program Files\MATLAB\R2013b\bin\win64\mkl.dll), but this is just the runtime library. I don't think there is anything you can do with it. To actually develop with Intel MKL, you will need the headers, libraries, etc., which can only be obtained by purchasing the product. It seems that MATLAB provides instructions on how to use LAPACK and BLAS functions from MEX-files via the import libraries libmwblas.lib and libmwlapack.lib in extern\lib\[arch]\[compiler]. It is not clear if it is possible and/or permissible to build non-MEX or generally MATLAB-independent applications using these libraries.

By the way, this mkl.dll was probably built using a procedure similar to the one posted here, which was a typical way of replacing ATLAS with MKL before MathWorks went ahead and did it for everyone, which by the way was a glorious day. However, these instructions seem to be intended for just getting the most recent version of MKL.

chappjc
  • 30,359
  • 6
  • 75
  • 132
  • actually you can write MEX-files and call BLAS/LAPACK functions from the Intel MKL implementation. See the second part of [this post](http://stackoverflow.com/a/6440839/97160) for an example. This is in fact officially [documented](http://www.mathworks.com/help/matlab/matlab_external/calling-lapack-and-blas-functions-from-mex-files.html). – Amro Dec 17 '13 at 00:30
  • @Amro OK, I stand corrected. Do you really have full access to the entire set of functionality available with the actual MKL API??? – chappjc Dec 17 '13 at 00:32
  • You can view the functions exported by `mkl.dll` inside "Dependency Walker". It is for most part BLAS/LAPACK functions. MATLAB provides import libraries for those, and the prototypes of those functions are well known. I'm not sure about the rest... – Amro Dec 17 '13 at 00:39
  • @Amro Deleting my answer, but I'd be curious to see a non-MEX (MATLAB-independent) application example using some LAPACK or BLAS function. Are the import libraries packaged with MATLAB no-strings-attached? I'm shocked Intel is OK with their product available for use in applications not requiring MATLAB installed to run. Purchasing MATLAB really gets you MKL? Wow. – chappjc Dec 17 '13 at 00:42
  • no need to delete the answer! As for Intel, I understand that once you purchase a license for MKL, you are free to redistribute the **binaries** with your application... Then again I'm not a lawyer, so better refer to their FAQ first :) http://software.intel.com/en-us/articles/intel-math-kernel-library-licensing-faq – Amro Dec 17 '13 at 00:45
  • @Amro Certainly you can redistribute the runtime libraries if you've not statically linked, but as for providing libmwblas.lib and libmwlapack.lib allowing you to call any BLAS/LAPACK function... I'd expect there to be language in the license prohibiting merely generating a wrapper for the product. :) – chappjc Dec 17 '13 at 00:52
  • truth is it doesnt matter if you only had DLLs without LIBs; You see import libraries are only needed for MS VC++ compiler/linker (in fact you [could](http://www.coderetard.com/2009/01/21/generate-a-lib-from-a-dll-with-visual-studio/) generate those .lib files yourself using only using the DLLs). MinGW/GCC compiler is able to directly link against a DLL without an import library. – Amro Dec 17 '13 at 01:01
  • Good point, but I'm talking about what is permissible. Is it OK to use the dll outside of a MATLAB application? Seems highly dubious. Whether you can link against it, or generate a stub .lib via a def file is another matter, I think! But I guess that would make it the user's legal burden, not MathWorks'. – chappjc Dec 17 '13 at 01:13
  • @Amro, chappjc, suppose hypothetically, it was OK to use the mkl.dll outside of a MATLAB application. Is there any easy way to use it with R? – uday Dec 17 '13 at 01:19
  • @uday: I dont know how easy this is, but I found this article about compiling R with MKL support: http://software.intel.com/en-us/articles/using-intel-mkl-with-r . Of course it mentions the official MKL framework, not one extracted from another product :) – Amro Dec 17 '13 at 01:28
  • 3
    @uday: btw Intel has a special license for Linux users developing non-commercial software, where you can download their entire compiler suite including the MKL libraries: http://software.intel.com/en-us/non-commercial-software-development – Amro Dec 17 '13 at 01:33
  • @Amro: I use this for playing with IPP at home. Good suggestion. – chappjc Dec 17 '13 at 01:34