Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.

Intel MKL SpMM

Deepika
Beginner
1,404 Views

Hi,

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?

0 Kudos
8 Replies
ArpitaP_Intel
Moderator
1,366 Views

Hello Deepika,


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

https://software.intel.com/content/www/us/en/develop/documentation/onemkl-developer-reference-c/top/blas-and-sparse-blas-routines/sparse-blas-level-2-and-level-3-routines/sparse-blas-level-2-and-level-3-routines-1.html#sparse-blas-level-2-and-level-3-routines-1_TBL2-9


Regarding

> 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.


Regards,

Arpita


0 Kudos
Kirill_V_Intel
Employee
1,346 Views

Hello!

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.

Thanks,
Kirill

0 Kudos
Deepika
Beginner
1,339 Views

Hello!

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?

Thanks,

Deepika

0 Kudos
Kirill_V_Intel
Employee
1,335 Views

Hello Deepika,

Please have a look at mkl_sparse_sp2m functionality, https://software.intel.com/content/www/us/en/develop/documentation/onemkl-developer-reference-c/top/blas-and-sparse-blas-routines/inspector-executor-sparse-blas-routines/inspector-executor-sparse-blas-execution-routines/mkl-sparse-sp2m.html. 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.

Best,
Kirill

Deepika
Beginner
1,329 Views

Thanks!

I will look at it.

Regards,

Deepika

0 Kudos
ArpitaP_Intel
Moderator
1,304 Views

Hi,

If your query is resolved, could you please let us know if I can close this thread.


Regards,

Arpita



0 Kudos
ArpitaP_Intel
Moderator
1,286 Views

Hi,


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.


Regards,

Arpita


0 Kudos
Deepika
Beginner
1,282 Views
0 Kudos
Reply