[petsc-users] max_it for EPS minres preconditioner

Pieter Ghysels pghysels at lbl.gov
Thu Apr 4 16:37:14 CDT 2019


Dear Jose,

It indeed works correctly when I set maxit after calling EPSSetUp.
Thanks!

Pieter

On Thu, Apr 4, 2019 at 12:30 PM Jose E. Roman <jroman at dsic.upv.es> wrote:

> Oops, the intention was to set 5 as the default value, but it is set at
> EPSSetUp() so changing it before is useless. This is wrong behaviour. I
> will try to fix it tomorrow.
> Jose
>
>
> > El 4 abr 2019, a las 20:45, Pieter Ghysels via petsc-users <
> petsc-users at mcs.anl.gov> escribió:
> >
> > Hi,
> >
> > I'm trying to set the maximum number of iterations in a minres
> preconditioner for the lobpcg eigensolver from SLEPc.
> > Using KSPSetTolerances, I can change the minres tolerance, but not maxit
> (it's always 5).
> >
> >   ierr = EPSCreate( PETSC_COMM_WORLD , &eps ) ;              CHKERRQ(
> ierr ) ;
> >   ...
> >
> >   ST st;
> >   KSP ksp;
> >   PC pc;
> >   ierr = EPSGetST( eps , &st ) ;                             CHKERRQ(
> ierr ) ;
> >   ierr = STSetType( st, STPRECOND ) ;                        CHKERRQ(
> ierr ) ;
> >   ierr = STGetKSP( st , &ksp ) ;                             CHKERRQ(
> ierr ) ;
> >   ierr = KSPSetType( ksp , KSPMINRES ) ;                     CHKERRQ(
> ierr ) ;
> >   ierr = KSPGetPC( ksp , &pc ) ;                             CHKERRQ(
> ierr ) ;
> >   ierr = PCSetType( pc , PCNONE ) ;                          CHKERRQ(
> ierr ) ;
> >   ierr = KSPSetTolerances
> >     ( ksp , /*tol_prec*/ 1e-10 , PETSC_DEFAULT , PETSC_DEFAULT ,
> /*maxit_prec*/ 7 ) ;
> >   CHKERRQ( ierr ) ;
> >   ierr = KSPSetFromOptions( ksp ) ;                          CHKERRQ(
> ierr ) ;
> >   ierr = STSetFromOptions( st ) ;                            CHKERRQ(
> ierr ) ;
> >   ierr = EPSSetFromOptions( eps ) ;                          CHKERRQ(
> ierr ) ;
> >
> >   ...
> >  ierr = EPSSetOperators( eps , mat , NULL ) ;             CHKERRQ( ierr
> ) ;
> >
> >  ierr = EPSSolve( eps ) ;                                 CHKERRQ( ierr
> ) ;
> >
> >
> >
> > When I run with -eps_view, I see:
> >
> > ...
> > EPS Object: 4 MPI processes
> >   type: lobpcg
> > ...
> > ST Object: 4 MPI processes
> >   type: precond
> >   shift: 0.
> >   number of matrices: 1
> >   KSP Object: (st_) 4 MPI processes
> >     type: minres
> >     maximum iterations=5, initial guess is zero
> >     tolerances:  relative=1e-10, absolute=1e-50, divergence=10000.
> >     left preconditioning
> >     using PRECONDITIONED norm type for convergence test
> >   PC Object: (st_) 4 MPI processes
> >     type: none
> > ...
> >
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20190404/a64ae68c/attachment-0001.html>


More information about the petsc-users mailing list