[petsc-users] Clarification of INSERT_VALUES for vec with ghost nodes

Zhang, Junchao jczhang at mcs.anl.gov
Wed Sep 25 22:15:09 CDT 2019


On Wed, Sep 25, 2019 at 9:11 AM Aulisa, Eugenio via petsc-users <petsc-users at mcs.anl.gov<mailto:petsc-users at mcs.anl.gov>> wrote:
Hi,

I have a vector with ghost nodes where each process may or may not change the value of a specific ghost node  (using INSERT_VALUES).

At the end I would like for each process, that see a particular ghost node, to have the smallest of the set values.
Do you mean owner of ghost nodes gets the smallest values. That is, in your example below, proc0 gets Min(value0, value1, value2)?


I do not think there is a straightforward way to achieve this, but I would like to be wrong.

Any suggestion?

%%%%%%%%%%%%%%%%

To build a work around I need to understand better the behavior of VecGhostUpdateBegin(...);  VecGhostUpdateEnd(...).

In particular in the documentation I do not see the option

VecGhostUpdateBegin(v, INSERT_VALUES, SCATTER_REVERSE);
VecGhostUpdateEnd(v, INSERT_VALUES, SCATTER_REVERSE);

In case this is possible to be used, what is the behavior of this call in the following two cases?

1) Assume that node-i belongs to proc0, and is ghosted in proc1 and proc2, also
assume that the current value of node-i is value0 and proc0 does not modify it, but proc1 and proc2 do.

start with:
proc0 -> value0
proc1 -> value0
proc2 -> value0

change to:
proc0 -> value0
proc1 -> value1
proc2 -> value2

I assume that calling
VecGhostUpdateBegin(v, INSERT_VALUES, SCATTER_REVERSE);
VecGhostUpdateEnd(v, INSERT_VALUES, SCATTER_REVERSE);
will have an unpredictable behavior as

proc0 -> either value1 or value2
proc1 -> value1
proc2 -> value2

2) Assume now that node-i belongs to proc0, and is ghosted in proc1 and proc2, also
assume that the current value of node-i is value0 and proc0 and proc1 do not modify it, but proc2 does.

start with:
proc0 -> value0
proc1 -> value0
proc2 -> value0

change to:
proc0 -> value0
proc1 -> value0
proc2 -> value2

Is the call
VecGhostUpdateBegin(v, INSERT_VALUES, SCATTER_REVERSE);
VecGhostUpdateEnd(v, INSERT_VALUES, SCATTER_REVERSE);
still unpredictable?

proc0 -> either value0 or value2
proc1 -> value0
proc2 -> value2

or

proc0 -> value2  (since proc1 did not modify the original value, so it did not reverse scatter)
proc1 -> value0
proc2 -> value2

Thanks a lot for your help
Eugenio







-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20190926/0a588575/attachment.html>


More information about the petsc-users mailing list