[petsc-users] Inquiry about the preconditioner setup of KSP.

Xiaodong Liu xliu29 at ncsu.edu
Tue Mar 3 22:26:56 CST 2020


Thanks  a lot.  I am transferring  a dense matrix from Julia to Petsc.
I will check this.
In addition, could you please show me where is

 Where is the subroutine for the GMRES solver, namely,
  ierr=(*KSP->ops->solve)(ksp);

Xiaodong Liu, PhD
X: Computational Physics Division
Los Alamos National Laboratory
P.O. Box 1663,
Los Alamos, NM 87544
505-709-0534


On Tue, Mar 3, 2020 at 8:21 PM Jed Brown <jed at jedbrown.org> wrote:

> Is it possible that Julia is transferring the matrix to PETSc as a dense
> matrix (storing the nonzeros) instead of preserving sparsity?  If you
> store the zeros, then ILU will be allowed to fill those entries, thereby
> becoming LU.
>
> Xiaodong Liu <xliu29 at ncsu.edu> writes:
>
> > I am trying to use Julia to call Petsc.
> > 1) First, I run the built-in example ex2.c
> >
> https://www.mcs.anl.gov/petsc/petsc-current/src/ksp/pc/examples/tutorials/ex2.c.html
> >
> > For this case,  I tried KSPGMRES , initial zero solution and different PC
> > (LU, ILU, ICC, JACOBI). And they work as expected.
> >
> >  75: KSPSetType(ksp,KSPGMRES);
> >  76: KSPSetInitialGuessNonzero(ksp,PETSC_FALSE);
> >  87: KSPGetPC(ksp,&pc);
> >  88: PCSetType(pc,PCICC);
> >
> > 2) Second, I tried to call KSP from Julia using the same matrix and right
> > hand side as ex2.c . A wrapper has been written to call Petsc code from
> > Julia. After I transfer matrix to from Julia to Petsc, I checked the
> matrix
> > and preconditioner matrix in the context of Petsc. These two matrices are
> > right. For no preconditioner,Jacobi precontioner and LU, the residual for
> > Julia version is same as that of original Petsc one for every iteration.
> > However, for ILU preconditioner, the residual for Julia is alwaysthe same
> > as the LU one. This is not expected. For both Julia and original Petsc
> > version, I checked the PC type inside the subroutine PCSetType and the
> > types are correct, namely ilu.I am trying to dig into the source code to
> > check how the preconditioner is interacting with GMRES.
> >
> > Where is the subroutine for the GMRES solver, namely,
> >  ierr=(*KSP->ops->solve)(ksp);
> >
> > Or do you have any suggestions?
> >
> > Thanks,
> >
> > Xiaodong Liu, PhD
> > X: Computational Physics Division
> > Los Alamos National Laboratory
> > P.O. Box 1663,
> > Los Alamos, NM 87544
> > 505-709-0534
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20200303/b6a293f9/attachment.html>


More information about the petsc-users mailing list