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

Issues with converting Sparse BLAS matrices

briancpark
Beginner
770 Views

Hi, 

 

I am becoming pretty desperate in trying to resolve this issue. I'm currently trying to benchmark SPMV kernels with MKL for research and I'm trying to compare the different formats for Sparse matrices, namely COO, CSC, CSR, BSR. COO is easy to manipulate and read data from, so I loaded the whole Sparse Suite Matrix collection library http://sparse.tamu.edu/ in COO format in MKL Sparse. Then I try to manipulate and convert from COO to the other respective formats using the MKL Sparse API. It's successful for COO and CSR, but I cannot get CSC conversion to work properly.  BSR failed, but I realized that I have to pad the sparse matrix dimension to fit the block_size.

 

For CSR, I do these calls:

mkl_sparse_s_create_coo
mkl_sparse_convert_csr
 
And for CSC, there is no such think as convert_csc, so I tried:
mkl_sparse_s_create_coo
mkl_sparse_s_export_csc
mkl_sparse_s_create_csc
 
it fails at mkl_sparse_s_export_csc, and gives me status value of  SPARSE_STATUS_INVALID_VALUE.
 
Is there anything that I need to be aware of or any reference code that I can look off of? I followed the documentation closely but couldn't really figure out what is wrong.
0 Kudos
1 Solution
Spencer_P_Intel
Employee
756 Views

CSC (column major compression) is the transpose of CSR (row major compression) format and visa-versa, so you could perform the transpose of your CSR matrix to get the "CSC" format.

So you can use https://www.intel.com/content/www/us/en/docs/onemkl/developer-reference-c/2023-1/mkl-sparse-convert-csr.html with operation = transpose.   then your output is already in "CSC" format and you can extract it as needed using mkl_sparse_?_export_csr

 

 

View solution in original post

0 Kudos
4 Replies
Spencer_P_Intel
Employee
757 Views

CSC (column major compression) is the transpose of CSR (row major compression) format and visa-versa, so you could perform the transpose of your CSR matrix to get the "CSC" format.

So you can use https://www.intel.com/content/www/us/en/docs/onemkl/developer-reference-c/2023-1/mkl-sparse-convert-csr.html with operation = transpose.   then your output is already in "CSC" format and you can extract it as needed using mkl_sparse_?_export_csr

 

 

0 Kudos
ShanmukhS_Intel
Moderator
693 Views

Hi,


A gentle reminder:

Has the information provided helped? Could you please let us know if there are any updates regarding your issue?


Best Regards,

Shanmukh.SS


0 Kudos
briancpark
Beginner
658 Views

Apologies for the late response. I tried it and just got some results. Seems like this method works. Thanks for the help!

0 Kudos
ShanmukhS_Intel
Moderator
642 Views

Hi,


It’s great to know that the issue has been resolved, in case you run into any other issues please feel free to create a new thread.


Best Regards,

Shanmukh.SS


0 Kudos
Reply