[petsc-dev] [petsc-users] VECMPICUSP with ghosted vector

Barry Smith bsmith at mcs.anl.gov
Mon Feb 6 13:11:16 CST 2012


On Feb 6, 2012, at 12:47 PM, Jed Brown wrote:

> On Mon, Feb 6, 2012 at 21:42, Matthew Knepley <knepley at gmail.com> wrote:
> I don't like this because it would mean calling VecSetUp() all over the place. Couldn't the ghosting flag be on the same
> level as the sizes?
> 
> Maybe VecSetUp() is wrong because that would imply collective. This memory allocation is simple and need not be collective.
> 
> Ghosting information is an array, so placing it in VecSetSizes() would seem unnatural to me. I wouldn't really want VecSetGhosts(Vec,PetscInt,const PetscInt*) to be order-dependent with respect to VecSetType(), but maybe the VecSetUp() would be too messy.

   Only some vectors support ghosting, so the usual PETSc way (like with KSPGMRESRestart()) is to calling the specific setting routines ONLY AFTER the type has been set.  Otherwise all kinds of oddball type specific stuff needs to be cached in the object and then pulled out later; possible but is that desirable? Who decides what can be set before the type and what can be set after? Having a single rule, anything appropriate for a subset of the types must be set after the type is set is a nice simple model.

   On the other hand you could argue that ALL vector types should support ghosting as a natural thing (with sequential vectors just have 0 length ghosts conceptually) then it would be desirable to allow setting the ghost information in any ordering.

   Sadly we now pretty much require MatSetUp() or a MatXXXSetPreallocation() to be called so why not always have VecSetUp() always called?

   We have not converged yet,

    Barry





More information about the petsc-dev mailing list