BLAS1 type operations on vectors

Does anyone know what MATLAB uses to perform operations like BLAS1, for example, dscalor daxpy?

>> a=ones(1,1e6,'double');
>> b=ones(1,1e6,'double');
>> a=2*a;  % dscal
>> a=2*a+1;
>> b=2*b+a; % daxpy

I replaced the MATLABs BLAS library using an environment variable BLAS_VERSION. I used a custom compiled (and modified) OpenBLAS and inserted some printfhere and there to find out if the MATLAB library is being called. I get printffor matrix-matrix multiplication, but I get nothing for simple BLAS1 operations. What a shame, because I really need it for performance reasons.

What makes me wonder - is MATLAB really reimplementing this basic functionality? What would be the reason for this? And finally, where is it implemented and can I preload / replace it?

+4
source share
1 answer

After further study, I am sure that MATLAB does not use BLAS for all vector operations (it uses it for some operations - see the Change note below). You can check it under Linux as follows. Run MATLAB, then

>> feature getpid
ans =
   13608

From checking the linux terminal, which dynamic libraries are loaded by MATLAB, or, to be precise, check if MKL is loaded (I'm testing on an Intel processor):

$ cat /proc/13608/numa_maps | grep mkl

, mkl . :

>> a=zeros(1, 1e6, 'double');
>> a=2*a; % dscal

:

$ cat /proc/13608/numa_maps | grep mkl

, , MKL. , BLAS1. BLAS3:

>> A=zeros(100);
>> B=A*A';

mkl

$ cat /proc/13608/numa_maps | grep mkl

7f4b687ec000 prefer:0 file=/home/matlab/R2013a/bin/glnxa64/mklcompat.so
7f4b6afb4000 prefer:0 file=/home/matlab/R2013a/bin/glnxa64/mkl.so
[...]

, MATLAB BLAS- BLAS3, , BLAS1. , MATLAB . , . , MATLAB (libmwmcr).

Edit , BLAS1 :

>> a=zeros(1, 1e6, 'double');
>> b=zeros(1, 1e6, 'double');
>> c=a*b';
+1

All Articles