[petsc-dev] misleading error message in VecWAXPY

Barry Smith bsmith at mcs.anl.gov
Tue Jun 5 13:13:06 CDT 2012


  Suggestions for improvements for the checks?

#define PetscValidLogicalCollectiveScalar(a,b,c)                        \
  do {                                                                  \
    PetscErrorCode _7_ierr;                                             \
    PetscReal b1[2],b2[2];                                              \
    b1[0] = -PetscRealPart(b); b1[1] = PetscRealPart(b);                \
    _7_ierr = MPI_Allreduce(b1,b2,2,MPIU_REAL,MPIU_MAX,((PetscObject)a)->comm);CHKERRQ(_7_ierr); \
    if (-b2[0] != b2[1]) SETERRQ1(((PetscObject)a)->comm,PETSC_ERR_ARG_WRONG,"Scalar value must be same on all processes, argument # %d",c); \
  } while (0)

#define PetscValidLogicalCollectiveReal(a,b,c)                          \
  do {                                                                  \
    PetscErrorCode _7_ierr;                                             \
    PetscReal b1[2],b2[2];                                              \
    b1[0] = -b; b1[1] = b;                                              \
    _7_ierr = MPI_Allreduce(b1,b2,2,MPIU_REAL,MPIU_MAX,((PetscObject)a)->comm);CHKERRQ(_7_ierr); \
    if (-b2[0] != b2[1]) SETERRQ1(((PetscObject)a)->comm,PETSC_ERR_ARG_WRONG,"Real value must be same on all processes, argument # %d",c); \
  } while (0)



On Jun 5, 2012, at 11:25 AM, Blaise Bourdin wrote:

> Hi,
> 
> It looks like when VecWAXPY is called with alpha=Nan, PetscValidLogicalCollectiveScalar causes the message "Scalar value must be same on all processes, argument # 2" to be printed. This is a bit misleading, and confusing when running on only 1 processor.
> 
> Is this something worth fixing?
> 
> Blaise
> 
> -- 
> Department of Mathematics and Center for Computation & Technology
> Louisiana State University, Baton Rouge, LA 70803, USA
> Tel. +1 (225) 578 1612, Fax  +1 (225) 578 4276 http://www.math.lsu.edu/~bourdin
> 
> 
> 
> 
> 
> 
> 




More information about the petsc-dev mailing list