[petsc-users] DMLocalToGlobal PETScSF is BROKEN

Jed Brown jed at jedbrown.org
Wed Jan 22 16:24:30 CST 2014


Barry Smith <bsmith at mcs.anl.gov> writes:

>      Jed and Matt,
>
>       This SF stuff is broken! Please fix.
>
> PetscErrorCode  DMLocalToGlobalBegin(DM dm,Vec l,InsertMode mode,Vec g)
> {
>   PetscSF        sf;
>   PetscErrorCode ierr;
>
>   PetscFunctionBegin;
>   PetscValidHeaderSpecific(dm,DM_CLASSID,1);
>   ierr = DMGetDefaultSF(dm, &sf);CHKERRQ(ierr);
>   if (sf) {
>     MPI_Op      op;
>     PetscScalar *lArray, *gArray;
>
>     switch (mode) {
>     case INSERT_VALUES:
>     case INSERT_ALL_VALUES:
>       op = MPIU_REPLACE; break;
>     case ADD_VALUES:
>     case ADD_ALL_VALUES:
>       op = MPI_SUM; break;
>     default:
>       SETERRQ1(PetscObjectComm((PetscObject)dm), PETSC_ERR_ARG_OUTOFRANGE, "Invalid insertion mode %D", mode);
>     }
>     ierr = VecGetArray(l, &lArray);CHKERRQ(ierr);
>     ierr = VecGetArray(g, &gArray);CHKERRQ(ierr);
>     ierr = PetscSFReduceBegin(sf, MPIU_SCALAR, lArray, gArray, op);CHKERRQ(ierr);
>     ierr = VecRestoreArray(l, &lArray);CHKERRQ(ierr);
>     ierr = VecRestoreArray(g, &gArray);CHKERRQ(ierr);
>
>    But the PetscSF stuff has no way of managing multiple begin/begin
>    in flight and no error checking to warn people against it.

SF holds a linked list of in-flight operations (indexed by the rootdata
pointer), see PetscSFBasicGetPackInUse.  However, I don't see a specific
test so it could have broken.  Note that VecScatter does not support
this at all.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20140122/3bc574b1/attachment-0001.pgp>


More information about the petsc-users mailing list