- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am trying to write a mex programm but it gives errors. When I use the VS2012 the code runs, but when I converted it to mex it didn't work. The code gives errors when it tries to use the mkl library (function dcopy, dgemm etc).
I have installed the Composer XE 2013 SP1 and I use this command to compile the code
mex -largeArrayDims ads.c -I"C:\Program Files (x86)\Intel\Composer XE 2013 SP1\mkl\include" -L"C:\Program Files (x86)\Intel\Composer XE 2013 SP1\mkl\lib\intel64" -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -lmkl_blas95_lp64 -lmkl_intel_ilp64 -lmkl_sequential -lmkl_blas95_lp64
For example I tried to use the function dcopy and the code and erros are:
#include <math.h> #include <stdio.h> #include <stdlib.h> #include <mkl.h> #include "mkl_vml.h" #include "mex.h" #include "matrix.h" #include "mkl_vsl.h" void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) { double a[4]={1,2,3,4}; double b[4]; cblas_dcopy(4, a, 1, b, 1); return; }
Errors:
>> mex -largeArrayDims ads.c -I"C:\Program Files (x86)\Intel\Composer XE 2013 SP1\mkl\include" -L"C:\Program Files (x86)\Intel\Composer XE 2013 SP1\mkl\lib\intel64" -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -lmkl_blas95_lp64 -lmkl_intel_ilp64 -lmkl_sequential -lmkl_blas95_lp64
Creating library C:\Users\F9E9~1\AppData\Local\Temp\mex_VlIT6Y\templib.x and object C:\Users\F9E9~1\AppData\Local\Temp\mex_VlIT6Y\templib.exp
mkl_intel_thread.lib(mkl_threading.obj) : error LNK2019: unresolved external symbol omp_in_parallel referenced in function mkl_serv_get_max_threads
mkl_intel_thread.lib(mkl_threading.obj) : error LNK2019: unresolved external symbol omp_get_max_threads referenced in function mkl_serv_get_max_threads
mkl_intel_thread.lib(mkl_threading.obj) : error LNK2019: unresolved external symbol omp_get_num_procs referenced in function mkl_serv_get_N_Cores
mkl_intel_thread.lib(dcopy_omp.obj) : error LNK2019: unresolved external symbol __kmpc_global_thread_num referenced in function mkl_blas_dcopy_omp
mkl_intel_thread.lib(dcopy_omp.obj) : error LNK2019: unresolved external symbol __kmpc_ok_to_fork referenced in function mkl_blas_dcopy_omp
mkl_intel_thread.lib(dcopy_omp.obj) : error LNK2019: unresolved external symbol __kmpc_push_num_threads referenced in function mkl_blas_dcopy_omp
mkl_intel_thread.lib(dcopy_omp.obj) : error LNK2019: unresolved external symbol __kmpc_fork_call referenced in function mkl_blas_dcopy_omp
mkl_intel_thread.lib(dcopy_omp.obj) : error LNK2019: unresolved external symbol __kmpc_serialized_parallel referenced in function mkl_blas_dcopy_omp
mkl_intel_thread.lib(dcopy_omp.obj) : error LNK2019: unresolved external symbol __kmpc_end_serialized_parallel referenced in function mkl_blas_dcopy_omp
mkl_intel_thread.lib(dcopy_omp.obj) : error LNK2019: unresolved external symbol omp_get_thread_num referenced in function mkl_blas_dcopy_omp
mkl_intel_thread.lib(dcopy_omp.obj) : error LNK2019: unresolved external symbol omp_get_num_threads referenced in function mkl_blas_dcopy_omp
ads.mexw64 : fatal error LNK1120: 11 unresolved externals
C:\USERS\F9E9~1\DOCUME~1\MATLAB~1\BIN\MEX.PL: Error: Link of 'ads.mexw64' failed.
I would like to ask if you could help me to fix the errors.
Thank you very much.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This is a known issue. The fix will be available in the next MKL release (version 11.1 update 3), which is due in about one month.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page