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

Aulisa, Eugenio Eugenio.Aulisa at ttu.edu
Wed Sep 25 09:04:48 CDT 2019


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. 

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









More information about the petsc-users mailing list