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

Question about mkl_?csrgemv

Heo__Jun-Yeong
451 Views

Hi, when I read reference manual of mkl, the mkl_?csrgemv routine calculates y=Ax (or y=A'x) where A is m-by-m matrix in 3-array CSR format.

However, when I tested, I figured out that this routine also works well in m-by-k matrix (both k<m and k>m).

Also, proper results are obtained even when I set ja and a not in order.

 ex) for 2-by-2 matrix, [(1, 2), (3, 4)], I set ja(1)=2, a(1)=2, ja(2)=1, a(2)=1, ...

     

Does this routine updated in recent version?

0 Kudos
2 Replies
mecej4
Honored Contributor III
451 Views

Some of the stated restrictions become understandable only if you consider that the routine in question can be asked to compute ATx or A.x, depending on the value of the UPLO argument. Unlike in the dense case, obtaining the CSR representation of AT, given A in the same representation, is not entirely trivial.

I sometimes feel that it would have been better to have separate routines for computing A.x and ATx when A is a sparse matrix in CSR or CSC format. With COO, things are simpler since all that needs to be done is to interchange row and column indices of nonzero entries.

0 Kudos
Spencer_P_Intel
Employee
451 Views

Also please note that these functions have been marked deprecated since mkl 2018 update 2 release.  They have been replaced by the Sparse Blas Inspector Executor functions (https://software.intel.com/en-us/mkl-developer-reference-c-inspector-executor-sparse-blas-routines ) which provide much more opportunity to improve performance.

For instance the new function call would be using the function

mkl_sparse_?_mv(...)   (https://software.intel.com/en-us/mkl-developer-reference-c-mkl-sparse-mv)

which can optionally be preceded by some optimization hints for even faster performance using

mkl_sparse_set_mv_hint(...) (https://software.intel.com/en-us/mkl-developer-reference-c-mkl-sparse-mv ) and then mkl_sparse_optimize(...) (https://software.intel.com/en-us/mkl-developer-reference-c-mkl-sparse-optimize ).

This setup will take in all sorts of size matrices and the hints provided allow the mkl_sparse_optimize(...) to make some decisions for internal data storage that will provide improved performance of the mv (or which ever operation hints were provided) operation.

0 Kudos
Reply