Community
cancel
Showing results for 
Search instead for 
Did you mean: 
may_ka
Beginner
209 Views

mkl_sparse_sp2m clarifications seeked

Jump to solution

@intel mkl team

after consulting the most recent manual about the mkl_sparse_sp2m routine I still couldn't work out the following

  • what is the output format of the newly created matrix C (csc, csr or bsr)?
    • My understanding is that mkl_sparse_sp2m supports mixed operations between csc and csr, csc and bsr, and csr and bsr, therefore determining the output format from the input format is ambiguous.
    • Further, from my understanding, according to here  C must not be initialized by routines like "MKL_SPARSE_D_CREATE_CSR". It is only required to allocate the "SPARSE_MATRIX_TYPE" container. then determining the output format type from the type of C seems not possible
  • on exit are pointerE and pointerB are unique arrays (point to non-overlapping sections of memory)?
  • is the content of row_indx/col_indx supposed to be sorted (as required by the three-array variation)?
    • from the example I have run with A and B are both csr matrices col_indx of C seems to be unsorted.

 

Thanks a lot.

 

 

0 Kudos
1 Solution
Kirill_V_Intel
Employee
192 Views

Hi @may_ka,

  • The output format is decided internally in the routine and might also depends on the flags in the descriptor.
    • Currently, sp2m routine supports mixed formats of the inputs only for CSR/CSC (first appeared around MKL 2019u4 or so).
      Unfortunately, there is no easy ~ single-line way currently to check the output format.
      One way is to test the formats by calling export routine and checking the status of the export_<format> routine (not very elegant, sure). Another way is to call a convert operation if you want your output to be in a specific format. 
      If you're using a different format than CSR/CSC, then I believe the output format will be the same as the format of the input (BSR or COO).
    • You're right, C must not be initialized. Otherwise a memory leak will occur since C will be reallocated in sp2m.
  • pointerB and pointerE are different for 4-array CSR. Internally, MKL AFAIK does not create 4-array CSR so the output of sp2m (if CSR format) will be a 3-array CSR which means that pointerE = pointerB + 1.
  • Again, you're correct. The output column/row indices for sp2m are not sorted, this is implied by the algorithm currently used. In order to sort the indices, one can call mkl_sparse_order for C afterwards.

I hope this helps.

Thanks,
Kirill

View solution in original post

2 Replies
Kirill_V_Intel
Employee
193 Views

Hi @may_ka,

  • The output format is decided internally in the routine and might also depends on the flags in the descriptor.
    • Currently, sp2m routine supports mixed formats of the inputs only for CSR/CSC (first appeared around MKL 2019u4 or so).
      Unfortunately, there is no easy ~ single-line way currently to check the output format.
      One way is to test the formats by calling export routine and checking the status of the export_<format> routine (not very elegant, sure). Another way is to call a convert operation if you want your output to be in a specific format. 
      If you're using a different format than CSR/CSC, then I believe the output format will be the same as the format of the input (BSR or COO).
    • You're right, C must not be initialized. Otherwise a memory leak will occur since C will be reallocated in sp2m.
  • pointerB and pointerE are different for 4-array CSR. Internally, MKL AFAIK does not create 4-array CSR so the output of sp2m (if CSR format) will be a 3-array CSR which means that pointerE = pointerB + 1.
  • Again, you're correct. The output column/row indices for sp2m are not sorted, this is implied by the algorithm currently used. In order to sort the indices, one can call mkl_sparse_order for C afterwards.

I hope this helps.

Thanks,
Kirill

View solution in original post

Gennady_F_Intel
Moderator
177 Views

This issue has been resolved and we will no longer respond to this thread. If you require additional assistance from Intel, please start a new thread. Any further interaction in this thread will be considered community only


Reply