[petsc-dev] viewing factored matrices

Barry Smith bsmith at mcs.anl.gov
Fri Nov 22 19:54:47 CST 2013


On Nov 22, 2013, at 7:18 PM, Dmitry Karpeyev <karpeev at mcs.anl.gov> wrote:

> Here's a somewhat radical proposal: move all calls to PetscOptionsGetXXX() to XXXSetUp().
> At the time of XXXSetUp() all of the nested objects are create or can be create, if they are not.
> XXXSetFromOptions() will only set a flag for XXX to look in the options database at setup time.
> This should help PCFieldSplit, for example.
> What is the need for having the intermediate state where the object is "set-from-options" but "not-yet-setup"?
> So that XXXView() can report the options before the data structures are built?  
   
   The original intention was so that user code could call XXXSetFromOptions() when they wanted to. Now that XXXSetFromOptions() for complicated things is generally not called directly by users (nor can be reasonably for nested solves) it is less of an issue.  We also originally intended that if the used did not call XXXSetFromOptions() then no SetFromOptions() was called for that hierarchy of solvers; to actually do that one would need to set a flag when the XXSetFromOptions() was called on the outer one and then on the inner solvers check that flag to see if one should call the XXXSetFromOptions() and propagate it inward.. We gave up on that and just called XXXSetFromOptions() on the inner ones without checking if we “should”, maintaining that flag was a pain.  We’d have to check all the code but maybe the XXXSetFromOptions() could only be called in the XXSetUp and it would make the code simpler and more uniform.



   Barry

> 
> 
> 
> 
> On Fri, Nov 22, 2013 at 5:36 PM, Jed Brown <jedbrown at mcs.anl.gov> wrote:
> Barry Smith <bsmith at mcs.anl.gov> writes:
> 
> >> Indeed, but I thought we wanted to avoid this because it can lead to
> >> options being checked on each iteration
> >
> >     No, no, and no.  Look in mg.c
> >
> >  if (!pc->setupcalled) {
> >     for (i=0; i<n; i++) {
> >       ierr = KSPSetFromOptions(mglevels[i]->smoothd);CHKERRQ(ierr);
> 
> In gamg.c:
> 
>   PetscBool      redo_mesh_setup = (PetscBool)(!pc_gamg->reuse_prol);
> 
>     if (redo_mesh_setup) {
>       /* reset everything */
>       ierr = PCReset_MG(pc);CHKERRQ(ierr);
>       pc->setupcalled = 0;
> 
> The number of levels can change because the strength of connection and
> thus thresholding changes.
> 
> >    You are correct that currently there are other unprotected calls in
> >    fieldsplit.c but I think they can be easily fixed so that the inner
> >    SetFromOptions() is called only when setup called is zero. Having
> >    non-nested XXXSetFromOptions() has nothing to do with things being
> >    check every iteration stuff.
> 
> Fair enough, the case above is a different issue and I agree that your
> other points are at the very least, pragmatic.
> 
> 
> 
> -- 
> Dmitry Karpeev
> Mathematics and Computer Science
> Argonne National Laboratory
> Argonne, Illinois, USA
> and
> Computation Institute
> University of Chicago
> 5735 S. Ellis Avenue
> Chicago, IL 60637
> -----------------------
> Phone: 630-252-1229
> Fax:   630-252-5986




More information about the petsc-dev mailing list