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

use of CGS in PARDISO

gregfi04
Beginner
1,459 Views

Hi,

I have a sparse, structurally-symmetric matrix. The solution of this matrix is part of a larger iterative solver, so the matrix needs to be solved many times. The values in the matrix will modestly change between iterations, but the sparsity pattern will remain the same.

Based on my reading of the PARDISO documentation, it sounds like this situation argues strongly for the implementation of the CGS iterative scheme. It sounds like PARDISO needs to be called once with phase=11, and then subsequently called with phase=23 and iparm(4)=31. Is this correct? I havent been able to get this to work. I get the following errors:

*** Error in PARDISO ( numerical_factorization) error_num= -3

*** Error in PARDISO: cgs error iparam(20) -22

Are there any public examples that would be useful? Any other thoughts?

Thanks,
Greg

0 Kudos
1 Solution
Alexander_K_Intel2
1,459 Views
Hi Greg,
I've attached my modification of pardiso_unsym_c.c, its return correct output. Could you modificate it and attach here to reproduce your issue?
With best regards,
Alexander Kalinkin

View solution in original post

0 Kudos
10 Replies
Alexander_K_Intel2
1,459 Views
Hi,
Am I right that you use mtype=1 or 3? Could you change it on 11 and 13 correspondantly and check the output? In any case could you send small testcase with compiling line to reproduce this issue on our side?
With best regards,
Alexander Kalinkin
0 Kudos
gregfi04
Beginner
1,459 Views
Hello Alexander,

Thanks for looking into this. You are correct that I was previously using mtype=1. Using mtype=11 appears to produce the same errors.

A test case is attached. I suspect that there may be something basic wrong with my input. Please let me know what you find.

Best Regards,
Greg
0 Kudos
Alexander_K_Intel2
1,459 Views
Hi,
I've include your data ( values got from sparse_values(1) ) in example named pardiso_unsym_c in example folder and can't reproduce your issue :( Maybe there are some problems with rhs or other parameters that you didn't provide... Could you provide small example with errors you mentioned and send it to me?
With best regards,
Alexander Kalinkin
0 Kudos
gregfi04
Beginner
1,459 Views
Hello,

I've re-attached the file to this posting, updated with the values of the RHS that I'm using. (The same RHS is used for each matrix.)

However, I suspect the problem I'm having is related to how I'm calling the subroutine. I have no problem using the "default" iparm values to call PARDISO and obtain a solution to the matrices. That works just fine. When I try to use the CGS iteration (iparm(4)=31 in Fortran, iparm[3]=31in C) to replace the computation of LU is when I encounter problems.

Based on my reading of the documentation, my best guess as to how this is supposed to work is as follows (example in abbreviated Fortran):
do ...

iteration = iteration + 1

sparse_values = ...

if(iteration == 1) then
phase=13
iparm(4) = 0
call pardiso(...)
else
phase=23
iparm(4)=31
call pardiso(...)
endif

enddo

When I attempt this, I get the following:

Percentage of computed non-zeros for LL^T factorization
1 % 3 % 6 % 9 % 12 % 15 % 18 % 20 % 22 % 24 % 27 % 31 % 34 % 36 % 40 % 45 % 55 % 99 % 100 %
*** Error in PARDISO ( numerical_factorization) error_num= -3
*** Error in PARDISO: cgs error iparam(20) -22
================ PARDISO: solving a real struct. sym. system ================
Summary PARDISO: ( factorize to solve )
================
Times:
======
Time spent in copying matrix to internal data structure(A to LU): 0.000000 s
Time spent in factorization step(numfct) : 0.000123 s
Time spent in iterative solver a solve step(cgs) : 0.000000 s cgx iterations -22

At what point in the pardiso_unsym_c are you modifying iparm(3)?

Thanks,
Greg
0 Kudos
Alexander_K_Intel2
1,460 Views
Hi Greg,
I've attached my modification of pardiso_unsym_c.c, its return correct output. Could you modificate it and attach here to reproduce your issue?
With best regards,
Alexander Kalinkin
0 Kudos
gregfi04
Beginner
1,459 Views
Hello Alexander,

I found the problem. Thank you!

After eliminating every other possibility,I noticed that I was using single-precision arrays whereas your code was using double-precision arrays. When I switched my arrays to double-preicision, the problem went away.

Since the matrices aren't going to be horribly large, I suppose we can use double-preicision arrays, but is there some reason single-precision isn't working? Could it be made to work?

Thanks again!
Greg
0 Kudos
Alexander_K_Intel2
1,459 Views
Hi,
The situation is strange... On my side example that I send to you work with single precision. Have you switched iparm[27] from 0 to 1?
With best regards,
Alexander Kalinkin
0 Kudos
Gennady_F_Intel
Moderator
1,459 Views
I didn't reproduce the problem also on my side with the latest (10.3.update) 4 version and with 32 and 64( LP64) bit cases.
--Gennady
0 Kudos
gregfi04
Beginner
1,459 Views
I have attached a sample program that exhibits the problem for me. When compiled and executed, this program produces:

*** Error in PARDISO ( numerical_factorization) error_num= -3
*** Error in PARDISO: cgs error iparam(20) -58

If Line 6 is commented out, Line 7 in un-commented, and Line 50 is commented out, the program will execute correctly. I'm using 12.0.3.

Greg
0 Kudos
Alexander_K_Intel2
1,459 Views
Hi,
I've reproduced your issue: this error mean that iterative algorithm made maximal number of iteration (150) and didn't achive good residual.
With best regards,
Alexander Kalinkin
0 Kudos
Reply