As far as I know, the answer is no. But you can create your own wrapper around sparse multiple MKL routines. You asked about the multiplication of two sparse matrices. The following is the shell code that I used to multiply one sparse matrix by a different dense vector, so itβs hard to adapt (see Intel MKL Link for mkl_cspblas_dcsrgemm). Also, remember how your scipy arrays are stored: coo is used by default, but csr (or csc) might be a better choice. I chose csr, but MKL supports most types (just call the appropriate procedure).
From what I could say, both scipy default and MKL are multi-threaded. By changing OMP_NUM_THREADS , I saw a performance difference.
To use the function below, if you have a recent version of MKL, just make sure you have LD_LIBRARY_PATHS to include the appropriate MKL directories. For older versions, you need to build some specific libraries. I got info from IntelMKL in python
def SpMV_viaMKL( A, x ): """ Wrapper to Intel SpMV (Sparse Matrix-Vector multiply) For medium-sized matrices, this is 4x faster than scipy default implementation Stephen Becker, April 24 2014 stephen.beckr@gmail.com """ import numpy as np import scipy.sparse as sparse from ctypes import POINTER,c_void_p,c_int,c_char,c_double,byref,cdll mkl = cdll.LoadLibrary("libmkl_rt.so") SpMV = mkl.mkl_cspblas_dcsrgemv
source share