[petsc-dev] be careful passing parallel MPI_Comm to SETERRQ()
Barry Smith
bsmith at mcs.anl.gov
Thu Jul 5 20:24:21 CDT 2012
Consider the following code:
ierr = ISSorted(iscol[i], &sorted); CHKERRQ(ierr);
if (!sorted) SETERRQ1(((PetscObject)iscol[i])->comm, PETSC_ERR_SUP, "Column index set %D not sorted", i);
ISSorted() is not a collective operation and just determines if the local part of the IS is sorted.
Hence some processes in comm may return true and some may return false.
In this situation you CANNOT call SETERRQ() with that collective comm. You must call it with PETSC_COMM_SELF
You can ONLY CALL SETERRQ with a collective comm if you know with absolute certainty that all processes in the comm will be calling it.
Barry
More information about the petsc-dev
mailing list