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

Matlab crashes when using both built-in MKL library, and MEX file invoking MKL

hareson
Beginner
411 Views
Hi

I'm trying to implement the band-matrix LU decomposition algorithm from the MKL in a matlab executeable file (MEX). Here I have trouble using the parallel libraries from the intel MKL, which causes my matlab version to crash.

Version Info:
Matlab r2010b - 64bit
Windows 7 64-bit
Compiler: MSVC++ express 2008
MKL Version using in MEX linking: 10.2.6.037
MKL Version used by Matlab: 10.0.3 (From what I could find in the help)

How to cause error
The error comes up if I use my .mex file in conjunction with the intermal matlab function 'lu'. This is done to test my implementation. If I use either by itself, nothing odd happens.

Current Documentation

In the Intel help for using MKL in Matlab, it is stated that it will crash if I use different versions in the MKL from what is used in Matlab. When I try to link to the libguide40.lib file though, my Matlab still crashes. The crash also happens so fast, that I can't see what the output window states. Is it possible to make it pause, or output to a text file?

(Solution)
My only current solution is to build to the sequential libraries. Is it possible to either update the matlab MKL library, or somehow make my build work in parallel regardless?



Cheers

Henrik Andresen
0 Kudos
4 Replies
Gennady_F_Intel
Moderator
411 Views
Henrik,
You don't have use libguide as was disscussed inthis thread.
Intel MKL does not provide opportunities to make a pause and then to run again.
I am not aware but it may help if you just replace the aged 10.0.3 Intel MKL's dll by the newest from version 10.2.6.
--Gennady
0 Kudos
hareson
Beginner
411 Views
Hi Gennady

I might just be missing the point, but I can't see any discussion of the libguide library in the thread you are linking to. Can you elaborate on this?


If I omit the libguide and use the 'mkl_intel_thread.lib' instead of 'mkl_sequential.lib', I get a lot of unresolved like:

mkl_intel_thread.lib(sgemv_omp.obj) : error LNK2001: unresolved external symbol __kmpc_global_thread_num
mkl_intel_thread.lib(sgemm_drv.obj) : error LNK2019: unresolved external symbol __kmpc_global_thread_num referenced in function mkl_blas_sgemm
mkl_intel_thread.lib(strsm_drv.obj) : error LNK2001: unresolved external symbol __kmpc_global_thread_num
mkl_intel_thread.lib(scopy_omp.obj) : error LNK2001: unresolved external symbol __kmpc_global_thread_num
mkl_intel_thread.lib(cgemv_omp.obj) : error LNK2001: unresolved external symbol __kmpc_global_thread_num

Which I assume is linked to the threading model.



Cheers


Henrik
0 Kudos
Andrey_G_Intel2
Employee
411 Views
Henrik,

could you try to build your mex file with libiomp5mt/libiomp5md instead of libguide/libguide40?

Andrey
0 Kudos
hareson
Beginner
411 Views
Hey Andrey

The libiomp5md version works perfectly. The 'mt' version crashes though.

Cheers

Henrik
0 Kudos
Reply