- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I'm using version 2022.1.0 to compute the addition of a sparse matrix, and I'm running into some problems. I read my matrix information from the txt file and created two sparse matrices, then I want to add the two matrices, I call the mkl_sparse_d_add function, then I can't get the result I want.
I used sparse_status_t to output the error message and it showed 2. I checked the code and couldn't find the error that appeared. I have put the code that reproduces this error below, thanks for any help.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @NEROKAI,
Thanks for reaching out to us about your issue. I've reviewed the code and the input files.
There appears to be a problem in your code. I see that you are creating your matrices with the following line:
mkl_sparse_d_create_csr(&STIF, SPARSE_INDEX_BASE_ONE, guimo + 1, guimo + 1, K_hangshouzhibiao, K_hangshouzhibiao + 1, K_lieshu, K_zhi);
In the above line, you are setting the number of rows and number of columns in your matrix both to "guimo+1" instead of (what I believe is the correct size, which is) "guimo". The line should have been:
mkl_sparse_d_create_csr(&STIF, SPARSE_INDEX_BASE_ONE, guimo, guimo, K_hangshouzhibiao, K_hangshouzhibiao + 1, K_lieshu, K_zhi);
Could you please try making the above change and let us know if that fixes your issue?
Here's the documentation for in case you need it for clarification: mkl_sparse_?_create_csr.
If this still doesn't fix the problem, please let us know the exact line you use to compile the program and link to oneMKL.
Regards,
Gajanan Choudhary
Software Engineer
Intel oneAPI Math Kernel Library (oneMKL)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Thank you very much for your help, I didn't realize this problem, thank you~
I can now run the code properly
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Nero,
>>I can now run the code properly
Thanks for the confirmation.
As the issue is resolved, we are going ahead and closing this thread. Please post a new question if you need any additional assistance from Intel as this thread will no longer be monitored.
Regards,
Vidya.

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