[petsc-dev] MatMult_Scatter : INSERT_VALUES?

Dave May dave.mayhem23 at gmail.com
Fri Aug 3 14:28:00 CDT 2018

Thanks Barry

On Fri, 3 Aug 2018 at 20:08, Smith, Barry F. <bsmith at mcs.anl.gov> wrote:

>    Hmm, I think the current code makes the most sense.

>     In your case what if the two "from" values destined for the same "to"
> location are different values, then your algorithm is ill-defined;

Indeed - but I can ensure this won't occur.

which of the two values "wins"?
>     To get the effect you want I think you need to insure that two
> different "from" locations are not destined for the same "to" location when
> you create the scatter.

Yeah ok

>     Barry
>     If you really need the effect you want and cannot fix the scatter you
> could use a MATSHELL to mimic the MATSCATTER behavior except using the
> INSERT_VALUES instead.

Due to various reason of my DM implementation this is kind of awkward to
do. Since I'd like to keep using the MatScatter API for consistency else
where in the code base, I think Instead I'll just override the mat mult
method for my special use case / DM implementation.


> > On Aug 3, 2018, at 3:09 AM, Dave May <dave.mayhem23 at gmail.com> wrote:
> >
> > Hi,
> >
> > I am wondering why MatMult_Scatter() internally uses ADD_VALUES with
> VecScatter{Begin,End} rather than INSERT_VALUES?
> >
> > In the event that the IS used by the scatter defines duplicate values in
> the to[] array, e.g. two ranks define the same value of where to insert a
> value, then the current implementation of MatMult_Scatter produces the
> incorrect result.
> >
> > You could argue that the user defined IS is wrong in this case as it
> contains duplicate to[] values. My particular use case of MatScatter
> relates to defining an injection operator between two DMs. For this case,
> I'd argue that that we should just be using INSERT_VALUES rather than
> ADD_VALUES inside MatMult_Scatter.
> >
> > Thoughts?
> >
> >
> > Cheers,
> >   Dave
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20180803/5b933be1/attachment.html>

More information about the petsc-dev mailing list