I was wondering if there is any way to know what matrix multiplication method/optimisation (inner-product, outer-product, row-wise product etc.) is used if I am using any sparse matrix-matrix multiplication routine in mkl, for example, mkl_sparse_spmm? And also, how is it decided and is there a way to control it, for example, if I want to use outer-product or row-wise product only how can I do that?
Thanks for reaching out to us.
Intel oneAPI MKL provides us with a large range of Sparse BLAS Level 2 and Level 3 Routines.
Please check the below link
> matrix multiplication/optimisation used in sparse matrix-matrix multiplication routine in MKL
We are working on it internally; we will get back to you soon.
There is no way to control the algorithm used, as of right now. I infer from your question that you are likely using CPU functionality. In this case, mostly commonly used methods are variants of Gustavson.
Could you please give us more details about why you want this control and in which case you want to use a particular method?
If you are interested in having the feature with explicit control over the method used underneath mkl_sparse_spmm or mkl_sparse_sp2m, you can submit a feature request.
Thank you for responding. I was trying to characterise different SpMM techniques for a course project. That's why I was checking if there is a way to control the algorithm used in MKL. Also, is there any subroutine in MKL that can help in estimating the size of the sparse product matrix given two input sparse matrices?
Please have a look at mkl_sparse_sp2m functionality, https://software.intel.com/content/www/us/en/develop/documentation/onemkl-developer-reference-c/top/.... It is an extended version of spmm.
In particular, it allows to do the matrix-matrix multiple in severl stages. The first of them will compute the rowStart/colStart array for the output matrix (when called with request=SPARSE_STAGE_NNZ_COUNT). So you can check the nnz in the output matrix before actually computing/allocating the arrays for column indices/values.
Hope we were able to resolve your issue. If you need any additional information, please submit a new query as this thread will no longer be monitored.