Community
cancel
Showing results for 
Search instead for 
Did you mean: 
ali_z_
Beginner
168 Views

Pardiso problem

Jump to solution

Hi,

I'm having a problem using pardiso solver in MKL library in direct or iterative mode. The manual says to choose between direct or iterative mode simply set the variable SOLVER (0=direct, 1=iterative) in :

call pardisoinit(PT, MTYPE, SOLVER, IPARM, DPARM, ERROR)

However, when i call the above routine the code crashes. It works only if i remove the variable SOLVER from the call. So it only works if i call the following:

call pardisoinit(PT, MTYPE, IPARM, DPARM, ERROR)

I'm using intel visual fortran composer xe on windows 8.1.

 
0 Kudos
1 Solution
Ying_H_Intel
Employee
168 Views

Hi Ali, 

General speaking, yes. pardiso for direct sovler and other for Iterative solver.

You can refer to MKL example ,which was in MKL install directory. it have exact c and fortan code to show how to solve one matrix. 

for example  fgmres_no_precon_c.c, cg_no_precon_c.c etc in solverc\source

Best Regards,
Ying

View solution in original post

12 Replies
Roman1
New Contributor I
168 Views

Which documentation are you looking at?  Have a look at:

https://software.intel.com/en-us/node/470286

It should be:

 call pardisoinit (pt, mtype, iparm)

 

ali_z_
Beginner
168 Views

Roman, I'm reading pardiso manual : http://pardiso-project.org/manual/manual.pdf

can you please tell me how can i choose the solution of my example to be iterative or direct ? the link you sent me don't mention that !

Thanks!

Roman1
New Contributor I
168 Views

The manual.pdf file in you link is not for MKL Pardiso.  The following is a quote from it:

Please note that this version is a significant extension compared to Intel's MKL version and that these improvements
and features are not available in Intel's MKL 9.3 release or later releases.

 

ali_z_
Beginner
168 Views

Thanks for your comment. According to the link you gave me, to choose between direct or iterative you need to set the parameter phase 23 or 33 for iterative. However, if i use 33 the solver gives NAN answer. It only works if i use phase =23. Can you please tell me if what i'm doing wrong, and how to choose between direct and iterative in mkl version of pardiso ?

Thanks !

JohnNichols
Valued Contributor I
168 Views

If you look at the Borr.zip files I loaded for another FEAST problem there is the worked solution from mecej4 to get PARDISO running easily. 

ali_z_
Beginner
168 Views

John, thanks for your comment. My problem is not in running Pardiso, it's how to make Pardiso works in Direct or iterative mod. According the manual i need to seet iparm(4)=0 and phase=23 for direct and iparm(4)=1 and phase =33 for iterative. The problem is when i set phase=33 the code is not giving the right answer. It gives NAN.

If you please could have a look at the code i attached, it's really very small few lines, could you just point out how i can make it work in direct or iterative mod. Thanks in advance !

JohnNichols
Valued Contributor I
168 Views

 

I see the problem, I could not get yours to work.  However the attached works with Iterative set. This is straight out of the manual for MKL and the samples, the only issue is coding the input matrix into the set of vectors -- I include my driver routine to check the input data. 

 

 

 

ali_z_
Beginner
168 Views

John, thanks but i also couldn't get yours to work too. However, in your code you set iparm(4) = 0 is this the only variable that needs to be switched to go from direct to iterative ? 0 is direct and 1 iterative ? 

Ying_H_Intel
Employee
168 Views

Hi Ali, 

Regarding the direct and iterative?  Could you please describe the problem which you want to solve to use direct or iterative respectively? 

In MKL manual,  there are two kind of sparse solver,  

for Sparse case:
1)  Direct solvers: PARDISO / DSS
2) Iterative solvers: RCI CG and FGMRES (requires matrix-vector multiplications, e.g., from Sparse BLAS, and (optionally) a
preconditioner, e.g., ILU0).

in general,  we call pardiso/DSS direct solver.    and RCI_CG or FGMRES are interative solver, which will use pardiso too internally. 

So if you expected the kind of  iterative in later, you may see the ISS section. 

The parameter in pardiso have some feature about iteration refinition etc, like  iparm(8) = 9  which is control the numbers of iterative refinement steps and iparm(4) please see the MKL manual. like it's value is 

31 LU-preconditioned CGS iteration with a stopping criterion of 1.0E-3 for nonsymmetric matrices
61 LU-preconditioned CGS iteration with a stopping criterion of 1.0E-6 for nonsymmetric matrices
62 LLT-preconditioned CGS iteration with a stopping criterion of 1.0E-6 for symmetric positive definite matrices

It is not about iparm(4)=0 and phase=23 for direct and iparm(4)=1 and phase =33 .  and you get  NAN,   actually,  it was because that 

The Intel MKL PARDISO solver performs four  phase. 

• analysis and symbolic factorization
• numerical factorization
• forward and backward substitution including iterative refinement
• termination to release all internal solver memory.

phase Solver Execution Steps
11 Analysis
12 Analysis, numerical factorization
13 Analysis, numerical factorization, solve, iterative refinement
22 Numerical factorization
23 Numerical factorization, solve, iterative refinement
phase Solver Execution Steps
33 Solve, iterative refinement

You may need to call at least  phase 22,  then go to phase 33.   If only phase 11 and phase 33,the key step of LU was missing.

Best Regards,

Ying  

 

When many solvers should be solved consecutively and next matrix is only slightly differs form previous one.
Applying factorization phase can not be so optimal in this case because the obtained solution will be slightly differs form
previous one. So iterative algorithm could be the most effective in this situation. Namely, PARDISO already has LU
decomposition for previous matrix and this decomposition can be used for constructing the effective preconditioner for
finding the new solution. Please see description of parameters 
iparm(4) - preconditioned CGS

 

iparm(4)
input
Preconditioned CGS/CG.
This parameter controls preconditioned CGS [Sonn89] for nonsymmetric or structurally
symmetric matrices and Conjugate-Gradients for symmetric matrices. iparm(4) has the
form iparm(4)= 10*L+K.
K=0 The factorization is always computed as required by phase.
K=1 CGS iteration replaces the computation of LU. The preconditioner is LU that was
computed at a previous step (the first step or last step with a failure) in a sequence
of solutions needed for identical sparsity patterns.
K=2 CGS iteration for symmetric positive definite matrices replaces the computation of
LLT. The preconditioner is LLT that was computed at a previous step (the first step
or last step with a failure) in a sequence of solutions needed for identical sparsity
patterns.
The value L controls the stopping criterion of the Krylow-Subspace iteration:
epsCGS = 10-L is used in the stopping criterion
||dxi|| / ||dx0|| < epsCGS
where ||dxi|| = ||inv(L*U)*ri|| for K = 1 or ||dxi|| = ||inv(L*LT)*ri|| for K =
2 and ri is the residue at iteration i of the preconditioned Krylow-Subspace iteration.
A maximum number of 150 iterations is fixed with the assumption that the iteration will
converge before consuming half the factorization time. Intermediate convergence rates and
residue excursions are checked and can terminate the iteration process. If phase =23,
then the factorization for a given A is automatically recomputed in cases where the Krylow-
Subspace iteration failed, and the corresponding direct solution is returned. Otherwise the
solution from the preconditioned Krylow-Subspace iteration is returned. Using phase =33
results in an error message (error=-4) if the stopping criteria for the Krylow-Subspace
iteration can not be reached. More information on the failure can be obtained from
iparm(20).
The default is iparm(4)=0, and other values are only recommended for an advanced user.
iparm(4) must be greater than or equal to zero.
Examples:

ali_z_
Beginner
168 Views

Hi Ying,

Thanks for your informative reply. If i understand you correctly:

1/i should call pardiso for direct solver and FGMRES for iterative solver

2/Is FGMRES also part of the mkl library, how do i set the variables to it? 

3/In my first comment you can see that i attached a file Solver.zip, it has a very small problem of few lines for a 5x5 matrix. I'm interested to know how i can solve this matrix using an iterative solver. In the file you can see that with pardiso it works pretty well. I'll be very thankful if you can show me the steps to solve the same inversion with iterative solver. 

Thanks again,

Ali

Ying_H_Intel
Employee
169 Views

Hi Ali, 

General speaking, yes. pardiso for direct sovler and other for Iterative solver.

You can refer to MKL example ,which was in MKL install directory. it have exact c and fortan code to show how to solve one matrix. 

for example  fgmres_no_precon_c.c, cg_no_precon_c.c etc in solverc\source

Best Regards,
Ying

View solution in original post

ali_z_
Beginner
168 Views

Many thanks Ying !

Reply