- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have created a small case that demonstrates that MKL crashes when used from MATLAB.
The MATLAB mex file should be created using MATLAB r2013a on linux64x86. The key is if the mex file, which is a shared object, is linked with libiomp5 then MKL crashes. If the mex file is linked without it works fine. You can reproduce the crash as follows
- Edit buildomp.sh i.e. adjust paths.
- sh buildomp.sh
- matlab
- testgemm
- MATLAB should crash now.
Try it again but remove -liomp5 in buildomp.sh.
Why does it crash when libiomp5 is linked into the mex file?
The system does not allow me to attached the needed files on this post but will try in the reply.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
It looks the files are not upload yet. Since Matlab itself is also using Intel MKL internally, to avoid conflicts with some other version MKL, it is suggested to build one customer DLL , then link the MKL to that customer DLL. Could you check these two articles for the steps:
http://software.intel.com/en-us/articles/using-intel-mkl-with-matlab
http://software.intel.com/en-us/articles/intel-math-kernel-library-intel-mkl-for-windows-using-intel-mkl-in-matlab-executable-mex-files
It takes windows at the example, it also has similar tools is also at mkl/tools/builder
Also have a check if you have other versions of openmp libraries from the matlab?
Thanks,
Chao
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The links you refrence is for Windows and seems to somewhat legacy information. Note my initial post explicit says Linux. The example has uploaded now.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have now posted this issue on Premier support since I did not get any reply here. I will summarize the findings here if anything comes out of it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I am trying to find the matlab to reproduce this problem. Also I have a few questions when I review your test code here:
1)The code is actually linking with libmkl_sequential.a, the sequential MKL libraries, so it actually does not need to add the –liomp5. Is the OpenMP runtime library added only for testing?
2)In the previous post, the list the code is crash bellow when adding OpenMP:
mkl_disable_fast_mm();
Is this still the code where it crash now? This code is actually not related to the OpenMP.
3)It looks you want to test whether OpenMP library is link it or not. Matlab is internally also using OpenMP, and include OpenMP libraries, so the system may have two copies of OpenMP libraries. Have you check if the OpenMP library you are linking with (the OpenMP with the MKL) is the same one when the cod is running?
Thanaks,
Chao
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I do understand that OpenMP is used for nothing in the code. This is a small illustrative example based on some real world code which is way more complicated. The code is very small and should be very easy to check whether we call mkl_disable_fast_mm(). As far as I remeber we do not.
Can you reproduce the crash? I think it would nice to understand why it crash even if we do something wrong because then we understand the assumptions behind OpenMP and MKL better.
I am not sure if MATLAB uses the same version on OpenMP. You can see my my blog post about why your reply about whether MATLAB and my application uses the same OpenMP library is one I hate. If that is an issue then we cannot OpenMP in the library we sell to our customers.
As far I understand we should be able to link with another version of MKL than MATLAB when we link with the static sequential version. Am I wrong on this assumption?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
>>As far I understand we should be able to link with another version of MKL than MATLAB when we link with the static sequential versionYes, this is true.
As to reproduce this problem, I am working with MKL code owner to have some further code review, and locate some more info. Now we are still working on to setup the matlab machine.
Thanks,
Chao
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page