[petsc-dev] MatMult_Scatter : INSERT_VALUES?
Smith, Barry F.
bsmith at mcs.anl.gov
Fri Aug 3 14:08:21 CDT 2018
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; 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.
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.
> 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
More information about the petsc-dev
mailing list