Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Intel Community
- Software
- Software Development SDKs and Libraries
- Intel® oneAPI Math Kernel Library
- sparse matrix multiplication mkl_?csrmultcsr example and limits

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

Kirk_D_

Beginner

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

07-18-2016
03:03 PM

314 Views

sparse matrix multiplication mkl_?csrmultcsr example and limits

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

1 Solution

Ying_H_Intel

Employee

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

07-18-2016
08:21 PM

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

Link Copied

5 Replies

Kirk_D_

Beginner

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

07-18-2016
03:04 PM

314 Views

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

Ying_H_Intel

Employee

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

07-18-2016
08:17 PM

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

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

07-18-2016
08:21 PM

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

Kirk_D_

Beginner

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

07-20-2016
02:09 PM

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

Alexander_K_Intel2

Employee

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

07-20-2016
10:13 PM

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

Topic Options

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

For more complete information about compiler optimizations, see our Optimization Notice.