Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Kirk_D_
Beginner
314 Views

sparse matrix multiplication mkl_?csrmultcsr example and limits

Jump to solution

Are there any examples of mkl_?csrmultcsr functions?  I have MKL 11.3 but have not found examples for these functions.  I am also interested in knowing the maximum dimension sizes for rows/cols of the matrices.

Thanks,
Kirk

0 Kudos
1 Solution
Ying_H_Intel
Employee
314 Views

 

Attached the sample. 

And you may find the mkl_?csrmultcsr sample in the forum , for example.    https://software.intel.com/en-us/forums/intel-math-kernel-library/topic/639846 

Best Regards,
Ying 

View solution in original post

5 Replies
Kirk_D_
Beginner
314 Views

Note that I am using C/C++ and on Windows if that make any difference.

Ying_H_Intel
Employee
314 Views

Hi Kirk, 

For the performance, i may recommend you to use the function mkl_sparse_spmm, it can calculate  sparce C =  sparse A* sparse B

sparse_status_t mkl_sparse_spmm (sparse_operation_t operation, const sparse_matrix_t A, const sparse_matrix_t B, sparse_matrix_t *C);

Include Files
• mkl_spblas.h
Description
The mkl_sparse_spmm routine performs a matrix-matrix operation:
C := op(A) *B
where A, B, and C are sparse matrices.

I update one c sample and the sample will be in MKL install folder /example/.  

Best Regards,

Ying 

Ying_H_Intel
Employee
315 Views

 

Attached the sample. 

And you may find the mkl_?csrmultcsr sample in the forum , for example.    https://software.intel.com/en-us/forums/intel-math-kernel-library/topic/639846 

Best Regards,
Ying 

View solution in original post

Kirk_D_
Beginner
314 Views

Thank you for the sample, I was able to figure out what I functions calls I needed. 

I have one question regarding the output however.  One of the result matrix items from the mkl_sparse_d_create_csr, mkl_sparse_spmm, and mkl_sparse_d_export_csr calls is coming out to a value of 0, and I would expect it NOT to be included in the result matrix in csr format, but it is. 

When looking at the matrix multiplication "by-hand" in dense matrix format, the cell in question should be calculated by (3*-2)+(9*0)+(0*0)+(0*5)+(0*9)+(3*2), which yields 0.  Any idea why this zero would be included in the resulting csr matrix?

Thanks,

Kirk

 

314 Views

Hi Kirk,

The reason of including "zero" element in resulted structure is the fact that structure and values calculated in different part of code to achieve better performance and it is hard to remove zero elements from structure after calculation. 

Thanks,

Alex

Reply