From: Sebastien Paris on

Hello,

I wanted to use ddot blas function in a mex-file but it seems to not using multi-thread... In the other hand BLAS 3 functions are (such xgemm) ....


I link with the in-shipped lib : libmwblas.lib

any idea ?

Sébastien
From: Sebastien Paris on
"Sebastien Paris" <sebastien.paris.nospam(a)lsis.org> wrote in message <htldah$nf6$1(a)fred.mathworks.com>...
>
> Hello,
>
> I wanted to use ddot blas function in a mex-file but it seems to not using multi-thread... In the other hand BLAS 3 functions are (such xgemm) ....
>
>
> I link with the in-shipped lib : libmwblas.lib
>
> any idea ?
>
> Sébastien

Ok I found a solution ....

First, in order to use Multi-threaded BLAS 1 function, you must include <omp.h> and be sure at least that your OMP_NUM_THREADS variable is set (to the number of core for example). Also use the Intel Compiler > 10.x ... With MSCV (2005 or 2008), it's not working

In a first try I linked with the in-shipped libmwblas.lib .... as :

mex -DopenMP -DBLAS -f mexopts_intel10.bat -output kernel.dll kernel.c "C:\Program Files\MATLAB\R2009b\extern\lib\win32\microsoft\libmwblas.lib"

And the system crashed with the intel compiler but worked in mono-thread with MSVC

tic,K = kernel(X , X , options);,toc
Elapsed time is 4.918193 seconds.

In a second attempt, I linked with the last build of MKL ...

mex -DopenMP -DBLAS -f mexopts_intel10.bat -output kernel.dll kernel.c "C:\Program Files\Intel\Compiler\11.1\065\mkl\ia32\lib\mkl_core.lib" "C:\Program Files\Intel\Compiler\11.1\065\mkl\ia32\lib\mkl_intel_c.lib" "C:\Program Files\Intel\Compiler\11.1\065\mkl\ia32\lib\mkl_intel_thread.lib"



tic,K = kernel(X , X , options);,toc
Elapsed time is 3.025927 seconds.



where kernel use here only a ddot blas function call ....