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

MKL sparse - problem with conversion to BSR

przemost
Beginner
330 Views

Hi,

I just want to convert a sparse matrix from COO to the BSR format using the code below. It works for very small matrices only. For larger ones I got "BSR error 3"  (for SPARSE_LAYOUT_ROW_MAJOR too). Direct conversion from COO to BSR works the same. What am I doing wrong?

Best

P

 

----------------------

sparse_matrix_t acoo,absr,acsr;

sparse_status_t stat = mkl_sparse_d_create_coo(&acoo, SPARSE_INDEX_BASE_ZERO, m, n, nz, I, J, val);

if(stat!=SPARSE_STATUS_SUCCESS){
printf("COO error %d\n",stat);
exit(1);
}

stat = mkl_sparse_convert_csr(acoo, SPARSE_OPERATION_NON_TRANSPOSE, &acsr);

if(stat!=SPARSE_STATUS_SUCCESS){
printf("CSR error %d\n",stat);
exit(1);
}

 

MKL_INT bsize=2;

stat = mkl_sparse_convert_bsr(acsr, bsize, SPARSE_LAYOUT_COLUMN_MAJOR, SPARSE_OPERATION_NON_TRANSPOSE, &absr);

if(stat!=SPARSE_STATUS_SUCCESS){
printf("BSR error %d\n",stat);
exit(1);
}

--------------------

 

 

0 Kudos
2 Replies
przemost
Beginner
302 Views

It seems I have solved the problem: the number of rows should be a multiple of bsize.

Best

P

0 Kudos
morskaya_svinka_1
New Contributor I
232 Views

You can code the convertion between matrix formats by yourself, this is an easy problem.

0 Kudos
Reply