[petsc-dev] Merging VecScatter objects

Dmitry Karpeev karpeev at mcs.anl.gov
Tue Mar 30 15:41:44 CDT 2010

Actually, it seems to me the easiest way to merge scatters is to reconstruct
the underlying ISs, merge those and then create the merged scatter.
A similar approach would work for composing scatters.

I'm experimenting with these things in the context of creating fully
block matrices, which the user occasionally wants to assemble (or vice versa,
taking regular matrices apart into collections of unassembled pieces).
I can implement the scatter manipulations there, under the hood, so the API
won't be inflated.  It should be easy later to expose this
functionality, if necessary.


On Tue, Mar 30, 2010 at 2:01 PM, Barry Smith <bsmith at mcs.anl.gov> wrote:
> 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