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

Most efficient storage format for sparse blas matrix-matrix multiply

soliton
Beginner
650 Views
Dear All,

I am starting to write a new application that will have to do sparse*dense matrix multiplies. Before just coding all the alternatives and benchmarking them I'd like to know whether it is know if one of the alternative storage formats is more efficient than the others. I am just guessing here, but it seems to me that CSR or CSC might help with data locality more that the coordinate format since in this case the ordering of the matrix can be basically random. Any clues?

Cheers,

Cristian
0 Kudos
2 Replies
Sergey_K_Intel1
Employee
650 Views

Dear Christian,

First of all,I'd recommend to take a lookat the structure of matrices. For example if it is known that a matrix consists of a few diagonals, the diagonal format is the best storage scheme to gain efficiency. If your matrix consists of many square dense blocks, please use the block sparse row.

If the matrix is not regularly structured, MKL Sparse BLAS routines for the CSR and CSC formats perform significantlybetter than for the coordinate format. If you are going to do non-transposed sparse-dense matrix multiplies for general matrices like A x, Id recommend to use the CSR format. The CSC format is preferable for transposed case A^T x. Id alsolike toremind that the routines for the CSR and CSC formats are OpenMP threaded.

All the best

Sergey

0 Kudos
soliton
Beginner
650 Views
Dear Sergey,

Many thanks for your swift reply.

Cheers,

Cristian


Dear Christian,

First of all,I'd recommend to take a lookat the structure of matrices. For example if it is known that a matrix consists of a few diagonals, the diagonal format is the best storage scheme to gain efficiency. If your matrix consists of many square dense blocks, please use the block sparse row.

If the matrix is not regularly structured, MKL Sparse BLAS routines for the CSR and CSC formats perform significantlybetter than for the coordinate format. If you are going to do non-transposed sparse-dense matrix multiplies for general matrices like A x, Id recommend to use the CSR format. The CSC format is preferable for transposed case A^T x. Id alsolike toremind that the routines for the CSR and CSC formats are OpenMP threaded.

All the best

Sergey

0 Kudos
Reply