[petsc-dev] What's the point of D(A/M)GetGlobalVector?

Jed Brown jed at 59A2.org
Fri Aug 27 08:47:13 CDT 2010


On Fri, 27 Aug 2010 08:27:22 -0500, Barry Smith <bsmith at mcs.anl.gov> wrote:
>      It would actually be nice if we made DACreateGlobal/LocalVector()
> so light-weight that it could be used for work vectors (instead of
> needing a different set of light weight get routines) but then we
> would need DADestroyGlobal/Vector() to handle putting back in the free
> list or need to modify VecDestroy() to handle not actually destroying
> but managing a free list).

Hmm, I'm not sure that only having Create versions would be a good
thing.  Overhead could be reduced to a VecDuplicate, but you still have
to allocate the memory.  Malloc is plenty fast (~400 cycles everywhere
I've checked) if you don't touch the memory, but traversing it extra
times is not ideal, yet the reproducibility of always zeroing newly
created vectors is handy.  Maybe there are places that malloc() is more
expensive, or that fragmentation (if you have some very small vectors,
or are using huge pages) would become a factor.

If the vectors are going to be persistent, their life has to be managed
somehow, in which case the Get versions are needed.  It also helps (me)
to clarify intent: if I see a Get, then I know the vector is temporary
without needing to check for a matching Destroy.

Jed



More information about the petsc-dev mailing list