<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<div dir="ltr">
<div dir="ltr"><br>
</div>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Wed, Sep 25, 2019 at 9:11 AM Aulisa, Eugenio via petsc-users <<a href="mailto:petsc-users@mcs.anl.gov">petsc-users@mcs.anl.gov</a>> wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Hi,<br>
<br>
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).
<br>
<br>
At the end I would like for each process, that see a particular ghost node, to have the smallest of the set values.
<br>
</blockquote>
<div>Do you mean owner of ghost nodes gets the smallest values. That is, in your example below, proc0 gets Min(value0, value1, value2)?</div>
<div> </div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
I do not think there is a straightforward way to achieve this, but I would like to be wrong.<br>
<br>
Any suggestion?<br>
<br>
%%%%%%%%%%%%%%%%<br>
<br>
To build a work around I need to understand better the behavior of VecGhostUpdateBegin(...);  VecGhostUpdateEnd(...).<br>
<br>
In particular in the documentation I do not see the option<br>
<br>
VecGhostUpdateBegin(v, INSERT_VALUES, SCATTER_REVERSE);<br>
VecGhostUpdateEnd(v, INSERT_VALUES, SCATTER_REVERSE);<br>
<br>
In case this is possible to be used, what is the behavior of this call in the following two cases?<br>
<br>
1) Assume that node-i belongs to proc0, and is ghosted in proc1 and proc2, also<br>
assume that the current value of node-i is value0 and proc0 does not modify it, but proc1 and proc2 do.<br>
<br>
start with:<br>
proc0 -> value0 <br>
proc1 -> value0<br>
proc2 -> value0<br>
<br>
change to:<br>
proc0 -> value0 <br>
proc1 -> value1<br>
proc2 -> value2<br>
<br>
I assume that calling<br>
VecGhostUpdateBegin(v, INSERT_VALUES, SCATTER_REVERSE);<br>
VecGhostUpdateEnd(v, INSERT_VALUES, SCATTER_REVERSE);<br>
will have an unpredictable behavior as<br>
<br>
proc0 -> either value1 or value2 <br>
proc1 -> value1<br>
proc2 -> value2<br>
<br>
2) Assume now that node-i belongs to proc0, and is ghosted in proc1 and proc2, also<br>
assume that the current value of node-i is value0 and proc0 and proc1 do not modify it, but proc2 does.<br>
<br>
start with:<br>
proc0 -> value0 <br>
proc1 -> value0<br>
proc2 -> value0<br>
<br>
change to:<br>
proc0 -> value0 <br>
proc1 -> value0<br>
proc2 -> value2<br>
<br>
Is the call <br>
VecGhostUpdateBegin(v, INSERT_VALUES, SCATTER_REVERSE);<br>
VecGhostUpdateEnd(v, INSERT_VALUES, SCATTER_REVERSE);<br>
still unpredictable?<br>
<br>
proc0 -> either value0 or value2 <br>
proc1 -> value0<br>
proc2 -> value2<br>
<br>
or<br>
<br>
proc0 -> value2  (since proc1 did not modify the original value, so it did not reverse scatter)<br>
proc1 -> value0<br>
proc2 -> value2<br>
<br>
Thanks a lot for your help<br>
Eugenio<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
</blockquote>
</div>
</div>
</body>
</html>