[petsc-users] max_it for EPS minres preconditioner

Jose E. Roman jroman at dsic.upv.es
Thu Apr 4 14:29:53 CDT 2019


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
> ...
> 



More information about the petsc-users mailing list