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

Help with Matlab C-mex integration

Deleted_U_Intel
Employee
295 Views
Hi,

I'm a PhD-Student doing some simulations with Matlab. I hope to improve the performance of some critical parts by using Intel MKL (Lapack), therefore I downloaded version 9.1.
I use ICC as compiler (v. 10.0) and Matlab 7.2.0, my system is a Core2Duo with OpenSuse Linux 10.2, kernel 2.6.18.8 bigsmp.
In order to set up the system, I successfullly compiled the yprime.c example with mex using icc.
To test the MKL, I added
#include "mkl.h"
to the source file and linked against necessary libs. There was no problem linking it against mkl_ia32. Whenever I additionally link against mkl_lapack, I get an error at run-time that says:

/opt/intel/mkl/9.1/lib/32/libmkl_lapack.so: undefined symbol: dptts2.

This is what matlab does in order to get the .mex-File:

-> icc -c -I/usr/local/matlab/extern/include -I/usr/local/matlab/simulink/include -DMATLAB_MEX_FILE -I/opt/intel/mkl/9.1/include -fPIC -pthread -O2 -parallel -axT -xT yprime.c

-> icc -c -I/usr/local/matlab/extern/include -I/usr/local/matlab/simulink/include -DMATLAB_MEX_FILE -I/opt/intel/mkl/9.1/include -fPIC -pthread -O2 -parallel -axT -xT /usr/local/matlab/extern/src/mexversion.c

-> icc -axT -xT -pthread -shared -Wl,--version-script,/usr/local/matlab/extern/lib/glnx86/mexFunction.map -o yprime.mexglx yprime.o mexversion.o -Wl,-rpath-link,/usr/local/matlab/bin/glnx86 -L/opt/intel/mkl/9.1/lib/32 -L/usr/local/matlab/bin/glnx86 -I/opt/intel/mkl/9.1/include -lmx -lmex -lmat -lmkl_lapack -lmkl_ia32 -lm

Before my experiments with Matlab I successfully built a plain C/MKL-program using the following:

Invoking: Compiler
icc -O3 -parallel -I/opt/intel/mkl/9.1/include -openmp-report1 -par-report3 -vec-report5 -axT -xT -MMD -MP -MF"hello.d" -MT"hello.d" -c -o "hello.o" "../hello.c"

Invoking: Linker
icc -axT -xT -L/opt/intel/mkl/9.1/lib/32 -o"hello_world" ./hello.o -lmkl_lapack -lmkl_ia32

I can run hello_world withoug any problems!

Thanks for your help!

Christian
0 Kudos
1 Reply
Vladimir_Lunev
New Contributor I
295 Views

Hi, Christian!

The my simplest testcase didn't show any issues. I've called the lapack function dptrfs() which uses DPTTS2. And I didn't see linkage error. Both static and dynamic MKL libraries have this entry point.

Please, which lapack-functions are you using? I don't need the real code, only the functions names.

Vladimir,
MKL library engineering.

0 Kudos
Reply