[petsc-dev] SNESConvergedDefault() side effect?

Peter Brune prbrune at gmail.com
Wed Jul 24 23:34:28 CDT 2013


On Wed, Jul 24, 2013 at 5:26 PM, Jed Brown <jedbrown at mcs.anl.gov> wrote:

> Dmitry Karpeyev <karpeev at mcs.anl.gov> writes:
>
> > Yes.  How should EW version 3 be implemented then?  Currently EW3
> > piggybacks on snes->ttol to get a measure of the initial norm of the
> > residual, and relies on it having been set elsewhere.  If no
> > references to snes->ttol in SNESKSPEW_PreSolve() are allowed, what
> > should take its place?
>
> I would say that EW3 should call VecNorm() on the first iteration.  Vecs
> cache their norms internally so this will only do one reduction, even if
> the SNES convergence test calls VecNorm() itself.
>
> > I was just thinking of a single cache for the initial residual norm.
> > Currently there are at least two, it seems to me.
>
> Well, snes->norm_init is currently serving a different purpose,


Yep, this was a cached value used to initialize the value in order to avoid
extra global reductions for FAS and nonlinear preconditioning, not
something to be used in tolerance tests.  This was pretty obvious from the
docs.  The SNESSetInitialFunction(Norm)() stuff has some logic in it based
upon the function being the same or different from the user set one, so
it's really not the place to set things for tolerance tests either.


> but it's
> not entirely clear that it needs to be set.  In particular, do we ever
> compute a norm using a side channel rather than by calling VecNorm,
> possibly followed by VecCopy?  If not, isn't calling
> SNESSetInitialFunction enough?


I'm convinced.  Created a branch getting rid of it and merged it into next.

https://bitbucket.org/petsc/petsc/commits/082749e3fd29b5b736d87e346c0f1a52377b27cf


>  SNES can just call VecNorm on F and
> it'll use the cached value if it was set.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20130724/abb1e3b8/attachment.html>


More information about the petsc-dev mailing list