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

Crash in dsyevd/dsyev functions

pat726627
Beginner
960 Views
Hi,

I have developed a DLL wrapper for third party applications to call the MKL functions in a higher level C++ class structure. I have implemented a general matrix class and the DLL wrapper does all the conversion between the high level C++ code to C-based MKL function call. Everything works out fine during the debugging stage, except when I deploy the DLL in release mode, the test application that calls the DLL gave me a fatal error:

Unhandled exception at 0x0336654a (mkl_wrapper.dll) in test_mkl_wrapper.exe: 0xC0000005: Access violation reading location 0x00000000.

Call stack:

mkl_wrapper.dll!_mkl_serv_allocate() + 0x1e bytes C
mkl_wrapper.dll!_mkl_blas_p4p_xdsyr2k() + 0x4f6 bytes Fortran
mkl_wrapper.dll!_mkl_blas_p4p_dsyr2k() + 0xc5c bytes C
mkl_wrapper.dll!_mkl_blas_dsyr2k() + 0xfa bytes C
mkl_wrapper.dll!_mkl_lapack_dsytrd() + 0x283 bytes Fortran
mkl_wrapper.dll!_mkl_lapack_dsyevd() + 0x3c7 bytes Fortran
mkl_wrapper.dll!_DSYEVD() + 0x59 bytes Asm
mkl_wrapper.dll!eig(const Matrix & A={...}, Matrix & eigenvalues={...}, Matrix & eigenvector={...}, Line 18 + 0x11 bytes C++
...
I tried with another eigenvalues routine dsyev() but it gives me the same crash.

I developed the application on MS Windows XP SP2 with Visual Studio 2005 SP1, and MKL version 9.1. I linked the wrapper DLL with MKL library statically (include library setting in VS2005: mkl_c.lib mkl_lapack.lib mkl_solver.lib libguide.lib). I have tried linking with the MKL dynamically but there wasn't any luck.

Interestingly, I can run the same application smoothly in debug mode with the same input and no changes in the code. The input matrix is just 52 by 52 doubles, so I don't think that's a problem on a 2GB RAM Intel Core Duo machine.

Got any ideas for this weird crash?

Thank you for your help!

0 Kudos
3 Replies
Trifon
Novice
959 Views

I am afraid you won't be able to achieve this. MKL version 9.1 and later does not allows its use from within a DLL project. I had the same problem for months now and Intel support could not find a solution.

See this post :
http://software.intel.com/en-us/forums//topic/55649

Tryusing the same code from within an exe project, most probably your code will work fine. Also you may try using MKL version 8.1 or older.

0 Kudos
pat726627
Beginner
959 Views
That means I have to link the whole MKL library dynamically with my own DLL, and also distribute those MKL runtime library DLLs when I deploy my DLL wrapper to third party?

There are 14 of them (32.2MB in my MKL version 9.1), is there any way to cut down the size of those DLLs? Like combining them into a single DLL?

0 Kudos
Andrey_G_Intel2
Employee
959 Views

Special tool for your needs exists in MKL. Its name is "custom DLL builder". You can find it in MKL oolsuilder folder. It is very simple and give to you ability of building your own DLL from MKL statical library. Your custom DLL will contain optimizations for all CPUs. You can choose set of MKL functions that will be included to your own DLL - it will reduce final size of DLL.

Andrey

0 Kudos
Reply