[petsc-dev] Is VecRestoreArray really not collective?

Patrick Lacasse patrick.m.lacasse at gmail.com
Wed Dec 12 14:56:40 CST 2012


Hi guys,

I got a dead lock by doing something like this :

Vec a;
[...]
PetscInt n;
VecNorm(a, NORM_INFINITY, &n);

PetscScalar* b;
Proc 0 -> VecGetArray(a, &b); [...] VecRestoreArray(a, b);
Proc 1 -> nothing

VecNorm(a, NORM_INFINITY, n);

Into VecNorm,
proc 0 stall in MPI_Allreduce
while proc 1 just took the norm into its cache.

What I understand is that PetscObjectStateIncrease has being called only
for proc 0 so that proc 1 doesn't know that the norm must be recalculated.

Should any function that call PetscObjectStateIncrease be consider
logically collective?

I have corrected my own code to use Vec(Get/Restore)Array collectively.

Patrick Lacasse
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20121212/aeb6af30/attachment.html>


More information about the petsc-dev mailing list