[petsc-dev] Is VecRestoreArray really not collective?

Barry Smith bsmith at mcs.anl.gov
Wed Dec 12 16:41:55 CST 2012


  Patrick,

    You are absolutely right (its a wonder it never hit us before). I have updated the manual pages in petsc-dev to reflect this.

   Barry

On Dec 12, 2012, at 2:56 PM, Patrick Lacasse <patrick.m.lacasse at gmail.com> wrote:

> 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
> 
> 




More information about the petsc-dev mailing list