Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.
7041 Discussions

mkl_sparse_d_add Error in addition of sparse matrix

NEROKAI
Beginner
812 Views

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.

 

0 Kudos
3 Replies
Gajanan_Choudhary
786 Views

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)

0 Kudos
NEROKAI
Beginner
750 Views

Hi,

Thank you very much for your help, I didn't realize this problem, thank you~

I can now run the code properly

0 Kudos
VidyalathaB_Intel
Moderator
747 Views

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.


0 Kudos
Reply