[petsc-dev] Better DMDestroy()
Matthew Knepley
knepley at gmail.com
Sun Nov 10 07:35:30 CST 2013
On Sun, Nov 10, 2013 at 4:05 AM, Lisandro Dalcin <dalcinl at gmail.com> wrote:
> In this branch https://bitbucket.org/petsc/petsc/branch/dalcinl/dm-destroy
> you will find my attempts to "fix" DMDestroy() by breaking reference
> cycles with the vectors stored in the unnamed/named global/local
> vector caches.
>
> This work is preliminary, I have a few more things I would like to
> change, and currently there is a test (snes ex5) that leaks memory.
>
> * I'm not sure why the lines below were introduced in DMDestroy(), but
> this is certainly not the right way to do it:
>
> for (f = 0; f < (*dm)->numFields; ++f) {
> PetscObjectCompose((*dm)->fields[f], "pmat", NULL);
> PetscObjectCompose((*dm)->fields[f], "nullspace", NULL);
> PetscObjectCompose((*dm)->fields[f], "nearnullspace", NULL);
> }
>
I don't think there is a better way to do it with composed objects. I was
evaluating the
interface. It looks like this is the best thing we could come up with, so
it should be
transitioned to real API calls, which can then be tracked in the same way
as the
named vectors.
Matt
> * I removed some lines from PCMG, but Jed told me privately there is
> a better way to do it, so I will need help here.
>
> * After reviewing carefully DMCreate[Global|Local]Vector() and some
> discussion with Jed, I really believe that the call to
> VecSetDM(newvec,dm) should be moved from implementation code to
> interface code, i.e. :
>
> @@ -702,6 +702,7 @@ PetscErrorCode DMCreateGlobalVector(DM dm,Vec *vec)
> PetscFunctionBegin;
> PetscValidHeaderSpecific(dm,DM_CLASSID,1);
> ierr = (*dm->ops->createglobalvector)(dm,vec);CHKERRQ(ierr);
> + ierr = VecSetDM(*vec,dm);CHKERRQ(ierr);
> PetscFunctionReturn(0);
> }
>
> Before continuing with this work, I would like your opinions about the
> approach. If it is accepted, then I'll proceed to ask for comments on
> what remains to be done.
>
>
>
> --
> Lisandro Dalcin
> ---------------
> CIMEC (UNL/CONICET)
> Predio CONICET-Santa Fe
> Colectora RN 168 Km 472, Paraje El Pozo
> 3000 Santa Fe, Argentina
> Tel: +54-342-4511594 (ext 1016)
> Tel/Fax: +54-342-4511169
>
--
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-dev/attachments/20131110/061264c7/attachment.html>
More information about the petsc-dev
mailing list