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

Aulisa, Eugenio Eugenio.Aulisa at ttu.edu
Thu Sep 26 03:28:19 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)?
If I can get the Min(value0, value1, value2) on the owner then I can scatter it forward with INSERT_VALUES to all processes that ghost it. And if there is a easy way to get Min(value0, value1, value2) on the owner (or on all processes) I would like to know.

Since I do not think there is a straightforward way to achieve that, I was looking at a workaround, and to do that I need to know the behavior of scatter reverse in the cases described below. Notice that I used the option INSERT_VALUES which I am not even sure is allowed.

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/e5266386/attachment-0001.html>


More information about the petsc-users mailing list