[petsc-dev] misleading error message in VecWAXPY

Jed Brown jedbrown at mcs.anl.gov
Tue Jun 5 13:19:02 CDT 2012


We could check PetscIsInfOrNanScalar first.

On Tue, Jun 5, 2012 at 1:13 PM, Barry Smith <bsmith at mcs.anl.gov> wrote:

>
>  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
> >
> >
> >
> >
> >
> >
> >
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20120605/0b1017e4/attachment.html>


More information about the petsc-dev mailing list