[petsc-users] KSP changes for successive solver

Michele Rosso mrosso at uci.edu
Sun Jul 19 13:56:20 CDT 2015


Hi,

I commented out  the following lines in src/ksp/pc/impls/mg/mg.c

if (!lu && !redundant && !cholesky && !svd && !bjaclu) {
       ierr = KSPSetType(mglevels[0]->smoothd,KSPGMRES);CHKERRQ(ierr);
    }

Now the coarse KSP is set to the value given via -mg_coarse_ksp_type and
not to GMRES by default. 
Is it safe to remove the above lines or it may create problems somewhere
else?

Thanks,
Michele

On Sun, 2015-07-19 at 10:33 -0400, Mark Adams wrote:
> This was fixed on June 18 (Stephen Kramer):
> 
> 
> 
>         
>         Can you please test this and see if works, without your fix?
>         
>           'git fetch; git checkout mark/gamg-crs',
> 
> 
> Great! That fixes everything for me: it uses KSP+PREONLY for mg_coarse
> by default again and I can also override it with -mg_coarse_ksp_type
> 
> Thanks a lot for fixing this
> Cheers
> 
> 
> 
> This was soon merged to master & next.  In src/ksp/pc/impls/mg/mg.c we
> have:
> 
> 
>     ierr =
> PetscObjectTypeCompare((PetscObject)cpc,PCLU,&lu);CHKERRQ(ierr);
>     ierr =
> PetscObjectTypeCompare((PetscObject)cpc,PCREDUNDANT,&redundant);CHKERRQ(ierr);
>     ierr =
> PetscObjectTypeCompare((PetscObject)cpc,PCCHOLESKY,&cholesky);CHKERRQ(ierr);
>     ierr =
> PetscObjectTypeCompare((PetscObject)cpc,PCSVD,&svd);CHKERRQ(ierr);
>     if (!lu && !redundant && !cholesky && !svd && !bjaclu) {
>       ierr = KSPSetType(mglevels[0]->smoothd,KSPGMRES);CHKERRQ(ierr);
>     }
> 
> 
> Perhaps our logic is failing here?  This is the only place where
> GMRES spontaneously appears.  We should really remove this altogether.
> 
> 
> 
> 
> 
> 
> On Sat, Jul 18, 2015 at 11:40 PM, Matthew Knepley <knepley at gmail.com>
> wrote:
> 
>         On Sat, Jul 18, 2015 at 10:31 PM, Michele Rosso
>         <mrosso at uci.edu> wrote:
>         
>                 Matt,
>                 
>                 please find the log_summary attached.
>                 
>         
>         
>         Okay, it is running master. Barry, where should he look in the
>         code to see why its still changing,
>         meaning what changeset fixed this?
>         
>         
>           Thanks,
>         
>         
>             Matt
>          
>                 Michele
>                 
>                 
>                 
>                 On Sat, 2015-07-18 at 21:56 -0500, Matthew Knepley
>                 wrote: 
>                 
>                 > On Sat, Jul 18, 2015 at 9:53 PM, Michele Rosso
>                 > <mrosso at uci.edu> wrote:
>                 > 
>                 >         Barry,
>                 >         
>                 >         I tried the master branch of PETSc as you
>                 >         suggested and unfortunately the problem with
>                 >         KSP being set to GMRES on the coarse level
>                 >         when using "-mg_coarse_ksp_type preonly"  is
>                 >         still there. I attached the output from ksp
>                 >         view and the options stack.
>                 >         Am I missing something?
>                 >         
>                 > 
>                 > 
>                 > 
>                 > If you show output from -log_summary we can make
>                 > sure you are running the version we expect.
>                 > 
>                 > 
>                 >   Thanks,
>                 > 
>                 > 
>                 >     Matt
>                 >  
>                 > 
>                 >         Thanks,
>                 >         Michele
>                 >         
>                 >         
>                 >         On Thu, 2015-07-16 at 17:30 -0500, Barry
>                 >         Smith wrote: 
>                 >         
>                 >         >    Michel,
>                 >         > 
>                 >         >     This is a very annoying feature that has been fixed in master http://www.mcs.anl.gov/petsc/developers/index.html  I would like to have changed it in maint but Jed would have a shit-fit :-) since it changes behavior.
>                 >         > 
>                 >         >   Barry
>                 >         > 
>                 >         > > On Jul 16, 2015, at 4:53 PM, Michele Rosso <mrosso at uci.edu> wrote:
>                 >         > > 
>                 >         > > Hi,
>                 >         > > 
>                 >         > > I am performing a series of solves inside a loop. The matrix for each solve changes but not enough to justify a rebuilt of the PC at each solve.
>                 >         > > Therefore I am using  KSPSetReusePreconditioner to avoid rebuilding unless necessary. The solver is CG + MG with a custom  PC at the coarse level.
>                 >         > > If KSP is not updated each time, everything works as it is supposed to. 
>                 >         > > When instead I allow the default PETSc  behavior, i.e. updating PC every time the matrix changes, the coarse level KSP , initially set to PREONLY, is changed into GMRES 
>                 >         > > after the first solve. I am not sure where the problem lies (my PC or PETSc), so I would like to have your opinion on this.
>                 >         > > I attached the ksp_view for the 2 successive solve and the options stack.
>                 >         > > 
>                 >         > > Thanks for your help,
>                 >         > > Michel
>                 >         > > 
>                 >         > > 
>                 >         > > 
>                 >         > > <ksp_view.txt><petsc_options.txt>
>                 >         > 
>                 >         
>                 >         
>                 >         
>                 > 
>                 > 
>                 > 
>                 > 
>                 > 
>                 > -- 
>                 > What most experimenters take for granted before they
>                 > begin their experiments is infinitely more
>                 > interesting than any results to which their
>                 > experiments lead.
>                 > -- Norbert Wiener
>                 
>                 
>                 
>         
>         
>         
>         
>         
>         
>         -- 
>         
>         What most experimenters take for granted before they begin
>         their experiments is infinitely more interesting than any
>         results to which their experiments lead.
>         -- Norbert Wiener
> 
> 
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20150719/2d0de899/attachment.html>


More information about the petsc-users mailing list