[petsc-dev] Merging VecScatter objects

Barry Smith bsmith at mcs.anl.gov
Tue Mar 30 15:01:33 CDT 2010


On Mar 30, 2010, at 2:55 PM, Dmitry Karpeev wrote:

> I think I need to merge several VecScatters S1, ..., Sn into a single
> VecScatter S,
> hoping that applying S will reduce the latency compared to applying S1
> through Sn in sequence.
> The assumptions here are that all the Si operate between the same  
> Vecs,
> that the target index ranges are disjoint and that at least one of the
> Vecs is an MPI Vec.
> Here are my questions:
> 1. Does anybody have any experience with something like this?
> 2. Is it even worth it trying to merge the scatters (the assumption is
> that the resulting S will be used many times)?
> 3. Is there an easy or existing way to do it?
> 4. If I have to do it, does anybody object to my introducing  
> something like
> VecScatterMergeScatters(PetscInt nScatters, VecScatter scatters[],
> VecScatter *mergedScatter)?
>
> Thanks.
> Dmitry.

    I would much prefer to see the merge done at the time of the ISs  
(that is before the sub scatters are created). Merging IS's is easy  
and won't inflate the size of the VecScatter interface. Even if you  
need separately both the separate vecscatters and the big vecscatter  
can't you just create them all directly? I guess the one case where  
this is painful is if you already have code that creates the  
individual scatters and you don't want to muck inside it to extract  
the ISs.

    As you will see, I try very hard to keep the PETSc API from  
growing whenever possible.


    Barry




More information about the petsc-dev mailing list