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

cluster_sparse_solver example does not work and cluster_sparse_solver_64 wrong results

Argyris
Beginner
2,141 Views

Dear all,

 

I use the MKL v2023.2.0 and I want to extract the matrices L, U from the LU decomposition of a sparse matrix. I have the following issues, though:

 

1) I tried to run the cl_solver_export_c.c example and after phase 11, I got error -1 (incosistent input).

 

2) When I modify the example by replacing cluster_sparse_solver by cluster_sparse_solver_64, I overcome the above error. Although, the matrices L, U contain wrong values (i.e. 1e+13) and the arrays l_ia, l_ja, u_ia and u_ja are totally wrong. Is it because I shouldn't use the cluster_sparse_solver function after cluster_sparse_solver_64?

 

Could you help me overcome these issues, please?

 

Thanks,

Argyris

0 Kudos
16 Replies
Argyris
Beginner
2,057 Views

FYI
I link mkl_blacs_intelmpi_lp64.lib and mkl_intel_lp64.lib instead of the ilp64 and the cluster_sparse_solver_export function seems to be working properly after calling cluster_sparse_solver (the corresponding example works properly).

0 Kudos
ShanmukhS_Intel
Moderator
2,040 Views

Hi,

 

Thanks for posting in Intel communities.

 

Based on your earlier response, it seems your issue was resolved. Could you please confirm the same?

 

Best Regards,

Shanmukh.SS

 

 

0 Kudos
Argyris
Beginner
2,029 Views

Thanks a lot for the response.

 

After I did the correction that I mentioned in my previous reply, I got the following issue:

 

L and U matrices that I get from the cluster_sparse_solver_export function contain values 1e+13. I guess this is because I have set iparm[9] = 13, so some diagonal elements are equal to 1e-13. I realize that this issue could be fixed by setting iparm[12] = 1. Although, by doing that, I got error = -9 after calling cluster_sparse_solver_get_csr_size function for the L matrix. Consider that my matrix A is of type 11.

 

Could you suggest a fix for this issue?

 

***EDIT: i.e. if I run the  cl_solver_export_c.c example as it is but with iparm[12] = 1 gives the error I mentioned above.

 

Thanks,

Argyris

0 Kudos
Argyris
Beginner
1,940 Views

Hi, 

 

based on last 4 lines on this link: export-functionality-in-the-cluster-sparse-solver  , I see that the export functionality cannot be used with enabled scaling and matching (iparm[10] and iparm[12]). Is this still valid?

 

If yes, how am I supposed to export the factors from my matrix, which has a lot of zero entries on the main diagonal? I remind you that with disabled scaling and matching, the function fails to compute a correct factorization.

 

Thanks,

Argyris

0 Kudos
ShanmukhS_Intel
Moderator
1,878 Views

Hi,

 

Could you please get back to us with a sample reproducer, OS details, and steps to reproduce (if any) so that we can try reproducing the issue at our end and help you accordingly?

 

Best Regards,

Shanmukh.SS

 

0 Kudos
Argyris
Beginner
1,863 Views

Hi,

 

  • the OS I use is Windows 11 64-bit
  • The example 12x12 matrix I worked on is:

          MKL_INT ia[13] = { 0,1,2,3,4,5,6,7,8,9,10,11,12 };
          MKL_INT ja[12] = { 3,5,4,6,8,7,9,11,10,8,7,6 };
          double a[12] = { -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,1 };

  • the iparm list I use is:

          iparm[0] = 1; 
          iparm[1] = 2;
          iparm[5] = 0; 
          iparm[7] = 2; 
          iparm[9] = 13; 
          iparm[10] = 0; 
          iparm[12] = 0; 
          iparm[17] = 0;
          iparm[18] = 0;
          iparm[27] = 0; 
          iparm[34] = 1; 
          iparm[39] = 0; 

  • I just want to export the L, U factors by using cluster_sparse_solver with a single thread.
  • The result U matrix I get is the following:

          row#1: (1.000000e-13, 0) (0.000000e+00, 10) (1.000000e+00, 11)
          row#2: (1.000000e-13, 1) (0.000000e+00, 4) (-1.000000e+00, 11)
          row#3: (-1.000000e+00, 2) (0.000000e+00, 3) (0.000000e+00, 10)
          row#4: (1.000000e-13, 3) (-1.000000e+00, 10)
          row#5: (1.000000e-13, 4) (-1.000000e+13, 11)
          row#6: (1.000000e-13, 5) (1.000000e+00, 9) (0.000000e+00, 11)
          row#7: (1.000000e-13, 6) (0.000000e+00, 9) (-1.000000e+00, 10)
          row#8: (1.000000e-13, 7) (-1.000000e+00,8 )
          row#9: (1.000000e-13, (-1.000000e+00, 9)
          row#10: (1.000000e+13, 9) (0.000000e+00, 10) (0.000000e+00, 11)
          row#11: (-1.000000e+13, 10) (0.000000e+00, 11)
          row#12: (1.000000e+13, 11)

 

          nonZeros = 29, numRows = 12

  • Please try to factorize the matrix with these parameters and then factorize it again by setting iparm[10] = iparm[12] = 1

 

Thank you a lot,

Argyris

0 Kudos
ShanmukhS_Intel
Moderator
1,738 Views

Hi,


Thanks for sharing the code snippet. However, Could you please get back to us with the complete working reproducer file? If you are using Visual Studio IDE, it would be an immense help if you share with us the zipped folder of the project files.


Best Regards,

Shanmukh.SS


0 Kudos
Argyris
Beginner
1,726 Views

Hi,

 

this is the example file. Please run it with iparm[10] = iparm[12] = 0 and then with iparm[10] = iparm[12] = 1.

 

Thanks a lot,

Argyris

0 Kudos
ShanmukhS_Intel
Moderator
1,534 Views

Hi,


It seems the main function is missing in the code and we are facing the below error because of that. Could you please share an updated source file?


LINK : fatal error LNK1561: entry point must be defined


Best Regards,

Shanmukh.SS


0 Kudos
Argyris
Beginner
1,521 Views

Hi,

 

here it is.

 

Thanks,

Argyris

0 Kudos
MatthiasK_Intel
Employee
927 Views

Dear Argyris,

 

we have not heard back from you, so I will close this inquiry now. If you need further assistance, please post a new question.

 

Best,

 

 

Matthias

0 Kudos
ShanmukhS_Intel
Moderator
1,402 Views

Hi,


Could you please try running your code on the latest oneMKL (2024.0) using the Intel oneAPI command prompt and let us know if the issue persists?


Best Regards,

Shanmukh.SS


0 Kudos
ShanmukhS_Intel
Moderator
1,329 Views

Hi,


Thanks for sharing. We are looking into your issue. We will get back to you soon with an update.


Best Regards,

Shanmukh.SS


0 Kudos
MatthiasK_Intel
Employee
1,293 Views

Dear Agyris, your matrix is singular, because column 0 and column 1 contain only zeros. This can be seen because the array “ja” does not contain the entries 0 and 1 anywhere. Adding 1e-13 to the corresponding diagonal elements of the matrix will introduce 1e+13 into the inverse matrix, so this is expected behaviour.

0 Kudos
ShanmukhS_Intel
Moderator
1,273 Views

Hi,


As mentioned, your matrix is singular, because column 0 and column 1 contain only zeros. This can be seen because the array “ja” does not contain the entries 0 and 1 anywhere. Adding 1e-13 to the corresponding diagonal elements of the matrix will introduce 1e+13 into the inverse matrix, so this is expected behaviour.


Best Regards,

Shanmukh.SS




0 Kudos
ShanmukhS_Intel
Moderator
1,133 Views

Hi,


A gentle reminder:

Has the information provided helped? Could you please let us know if there are any updates on your issue?


Best Regards,

Shanmukh.SS


0 Kudos
Reply