The MATLAB utility “mex” (enter “help mex” in command window in MATLAB) is a wrapper for your actual compiler, like gcc. It does not support intels icc. But this is no reason not to use the Intel MKL libraries! Write your code and compile it with:
1 |
mex cpuMatrixCBLAS.c -I/opt/intel/Compiler/11.1/069/mkl/include/ -L/opt/intel/Compiler/11.1/069/mkl/lib/em64t /opt/intel/Compiler/11.1/069/mkl/lib/em64t/libmkl_solver_lp64_sequential.a -Wl,--start-group /opt/intel/Compiler/11.1/069/mkl/lib/em64t/libmkl_intel_lp64.a /opt/intel/Compiler/11.1/069/mkl/lib/em64t/libmkl_sequential.a /opt/intel/Compiler/11.1/069/mkl/lib/em64t/libmkl_core.a -Wl,--end-group -lpthread -lrt |
Looks ugly, but is just a matter of copy pasting from the following website. Then gcc will compile your code and link the Intel libraries! The linking process is somewhat tricky, therefore use
http://software.intel.com/en-us/articles/intel-mkl-link-line-advisor/
to determine everything after the file name in the compiling command. Remember to select static linking on the website.