[petsc-users] Destroy ghosted vector that was used to duplicate

John Mousel john.mousel at gmail.com
Wed Jun 19 20:05:43 CDT 2013


I just figured out that I had a well hidden duplication of a duplication of
the vector I was trying to resize. Hence the run-up in persistent
communications. This kind of dependency is somewhat difficult to track
down. Is there any way to check the vectors dependent on a particular
scatter?


On Wed, Jun 19, 2013 at 5:59 PM, Barry Smith <bsmith at mcs.anl.gov> wrote:

>
>   John,
>
>    When a VecCreateGhost() is duplicated the new vector shares the
> VecScatter with the original vector. In your example below vec2 and vec3
> share the VecScatter. Hence the VecScatter has a reference count of 3. When
> you call VecDestroy(vec1) the reference count for that scatter falls to 2.
> Once vec2 and vec3 are destroyed the reference count for the VecScatter
> falls to zero and it is destroyed. Hence no memory (or MPI persistent
> communication resources) should be lost.
>
>     Note that even if you do not plan to use the "local vector" part of
> vec2 and vec3 that VecScatter will still be around until you destroy vec2
> and vec3 and any other Vecs obtained by VecDuplicating any of these. If you
> want to eliminate the VecScatter then don't use a VecDuplicate() on the
> ghosted vector instead create a non-ghosted vector.
>
>
>    This is the way it is suppose to be anyways. Are you observing
> something different that could be reproduced in a somewhat reasonably small
> example?
>
>    Barry
>
> On Jun 19, 2013, at 2:45 PM, John Mousel <john.mousel at gmail.com> wrote:
>
> > Looking at the message queue graph in Totalview, it seems that I'm
> running up the number of persistent communications when I try to resize a
> vector by duplicating, copying, destroying, and calling VecCreateGhost.
> >
> >
> > On Wed, Jun 19, 2013 at 2:42 PM, Matthew Knepley <knepley at gmail.com>
> wrote:
> > On Wed, Jun 19, 2013 at 6:24 PM, John Mousel <john.mousel at gmail.com>
> wrote:
> > Is it legal to destroy a ghosted vector if it has been used in
> VecDuplicate?
> >
> > This is fine.
> >
> >    MAtt
> >
> > Something like:
> >
> > VecCreateGhost(...,vec1)
> > VecDuplicate(vec1,vec2)
> > VecDuplicate(vec1,vec3)
> > VecDestroy(vec1)
> > VecAXPY(vec2,1.0,vec3)
> >
> > Is this legal or are the scatters left hanging in the ether?
> >
> >
> > John
> >
> >
> >
> > --
> > 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/20130619/543f1533/attachment.html>


More information about the petsc-users mailing list