- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Hi there,

I am having some memory problems regarding the conversion of a CSR matrix to BSR.

Can anyone tell me some links/books/examples regarding that MKL functionality?

Thank you in advance,

Filipe Oliveira

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Hi,

Have you try csr2bsr converter via new Inspector-executor SparseBlas API? The pseusocode for this converter could be represented by following scheme:

sparse_status_t status;

sparse_matrix_t A_csr, A_bsr;

status = mkl_sparse_d_create_csr ( &A_csr, SPARSE_INDEX_BASE_ZERO, m, n, ia, ia+1, ja, val );

status = mkl_sparse_convert_bsr ( A_csr, mblk, SPARSE_LAYOUT_ROW_MAJOR, SPARSE_OPERATION_NON_TRANSPOSE, &A_bsr );

MKL_INT rows=0, cols=0, *ib, *rows_end, *jb, block_size;

sparse_index_base_t indexing;

sparse_layout_t block_layout;

double *b;

status = mkl_sparse_d_export_bsr ( A_bsr, &indexing, &block_layout, &rows, &cols, &block_size, &ib, &rows_end, &jb, &b);

Thanks,

Alex

Link Copied

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

In the CSR representation, only the non-zero elements are stored (exception: some routines may require that zero-value elements on the main diagonal should be stored). In the BSR representation, only non-zero blocks are stored.

Thus, if the block-size = 1, the two representations are similar in storage requirements. When the block-size is not equal to 1, on the other hand, if there is at least one non-zero element in any block, all the elements in that block need to be stored (block-wise, it is "store all or none" rule that has to be followed).

As the block-size is increased, the number of within-block zeros that have to be kept will increase. Finally, when the block-size becomes equal to the matrix size, *n*, the entire *n*^{2} elements of the *n* X *n* full matrix will have to be kept even in the BSR representation.

I hope that you see now why the memory footprint of a BSR matrix increases when the block-size is increased.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

pls have a look at the <mkldirectory>\examples\spblasc\source\dconverters.c example.

//* TASK 5 Obtain block sparse row matrix from compressed sparse row matrix

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

hi there,

thank you for the quick reply. is there any limitation regarding the matrix dimension in CSR format? does it need to squared in order to be convertible to BSR?

i am also getting an strange output of the mkl_scsrbsr(...) conversion. the float *absr array is returning empty even with the correct job config:

job[0] = 0; //If job[0]=0, the matrix in the CSR format is converted to the BSR format;

168 job[1] = 0; //If job[1]=0, zero-based indexing for the matrix in CSR format is used;

169 job[2] = 0; //If job[2]=0, zero-based indexing for the matrix in the BSR format is used;

170 job[3] = 0; //

171 job[4] = 0; //

172 job[5] = 1; //If job[5]>0, all output arrays absr, jab, and iab are filled in for the

regards,

Filipe Oliveira

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Hi,

Have you try csr2bsr converter via new Inspector-executor SparseBlas API? The pseusocode for this converter could be represented by following scheme:

sparse_status_t status;

sparse_matrix_t A_csr, A_bsr;

status = mkl_sparse_d_create_csr ( &A_csr, SPARSE_INDEX_BASE_ZERO, m, n, ia, ia+1, ja, val );

status = mkl_sparse_convert_bsr ( A_csr, mblk, SPARSE_LAYOUT_ROW_MAJOR, SPARSE_OPERATION_NON_TRANSPOSE, &A_bsr );

MKL_INT rows=0, cols=0, *ib, *rows_end, *jb, block_size;

sparse_index_base_t indexing;

sparse_layout_t block_layout;

double *b;

status = mkl_sparse_d_export_bsr ( A_bsr, &indexing, &block_layout, &rows, &cols, &block_size, &ib, &rows_end, &jb, &b);

Thanks,

Alex

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Alexander Kalinkin (Intel) wrote:

Hi,

Have you try csr2bsr converter via new Inspector-executor SparseBlas API? The pseusocode for this converter could be represented by following scheme:

sparse_status_t status;

sparse_matrix_t A_csr, A_bsr;status = mkl_sparse_d_create_csr ( &A_csr, SPARSE_INDEX_BASE_ZERO, m, n, ia, ia+1, ja, val );

status = mkl_sparse_convert_bsr ( A_csr, mblk, SPARSE_LAYOUT_ROW_MAJOR, SPARSE_OPERATION_NON_TRANSPOSE, &A_bsr );

MKL_INT rows=0, cols=0, *ib, *rows_end, *jb, block_size;

sparse_index_base_t indexing;

sparse_layout_t block_layout;

double *b;status = mkl_sparse_d_export_bsr ( A_bsr, &indexing, &block_layout, &rows, &cols, &block_size, &ib, &rows_end, &jb, &b);

Thanks,

Alex

hi there,

is there any relation between mblk and possible memory leaks or incorrect memory acesses? because depending on the block size i get sometimes segmentation fault errors in mkl_sparse_convert_bsr.

Also, is there any mkl debugging tool in OS X?

thank you in advance,

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Hi,

mblk have to be divider of nrows and ncols. In this case could I ask you to send reproducer of this issue to me to understand reason of memory leaks/segfault?

Thanks,

Alex

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Alexander Kalinkin (Intel) wrote:

mblk have to be divider of nrows and ncols.

could you please rephrase this part?

If our matrix is **M** rows by **N** columns, our mblk is **n*m, N = k*n **(k integer), and** M = j*m **(j integer), does k need to have the same value as j?

Regards,

Filipe Oliveira and Sérgio Caldas

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page