[petsc-dev] Discussion about time-dependent optimization moved from PR

Jed Brown jed at jedbrown.org
Tue Oct 17 11:35:32 CDT 2017


Lawrence Mitchell <wencel at gmail.com> writes:

>> On 17 Oct 2017, at 15:47, Jed Brown <jed at jedbrown.org> wrote:
>> 
>>> c.f. also the petsc-maint discussion last October in the thread:
>>> 
>>> "Segfault when DM is reused in two SNESes with multigrid"
>> 
>> What should I do?  That thread petered out when nobody could suggest a
>> criteria to distinguish reuse of a DM in related SNES objects (e.g.,
>> nonlinear preconditioning or nonlinear multigrid) from reuse with intent
>> to solve different problems.
>
> So my initial concern was that if I do:
>
> SNESSetDM(snes, dm);
> SNESSolve(snes);
> SNESDestroy(&snes);
>
> Then dm still has stale pointers to snes (in the context of the
> restrict hook).  

Thanks, this is fixable.  Can someone make a test case for me?

> These aren't cleaned up until DMDestroy.  It was surprising to me that
> SNESDestroy did not clean up all the things that SNESCreate/Solve set
> up.
>
> I don't care about the case of:
>
> SNESSetDM(snes1, dm);
> SNESSetDM(snes2, dm);
>
> I work around this issue by making new DMs, so it's OK if nothing changes in PETSc.  
>
> Lawrence


More information about the petsc-dev mailing list