We could check PetscIsInfOrNanScalar first.<br><br><div class="gmail_quote">On Tue, Jun 5, 2012 at 1:13 PM, Barry Smith <span dir="ltr"><<a href="mailto:bsmith@mcs.anl.gov" target="_blank">bsmith@mcs.anl.gov</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
Suggestions for improvements for the checks?<br>
<br>
#define PetscValidLogicalCollectiveScalar(a,b,c) \<br>
do { \<br>
PetscErrorCode _7_ierr; \<br>
PetscReal b1[2],b2[2]; \<br>
b1[0] = -PetscRealPart(b); b1[1] = PetscRealPart(b); \<br>
_7_ierr = MPI_Allreduce(b1,b2,2,MPIU_REAL,MPIU_MAX,((PetscObject)a)->comm);CHKERRQ(_7_ierr); \<br>
if (-b2[0] != b2[1]) SETERRQ1(((PetscObject)a)->comm,PETSC_ERR_ARG_WRONG,"Scalar value must be same on all processes, argument # %d",c); \<br>
} while (0)<br>
<br>
#define PetscValidLogicalCollectiveReal(a,b,c) \<br>
do { \<br>
PetscErrorCode _7_ierr; \<br>
PetscReal b1[2],b2[2]; \<br>
b1[0] = -b; b1[1] = b; \<br>
_7_ierr = MPI_Allreduce(b1,b2,2,MPIU_REAL,MPIU_MAX,((PetscObject)a)->comm);CHKERRQ(_7_ierr); \<br>
if (-b2[0] != b2[1]) SETERRQ1(((PetscObject)a)->comm,PETSC_ERR_ARG_WRONG,"Real value must be same on all processes, argument # %d",c); \<br>
} while (0)<br>
<div class="HOEnZb"><div class="h5"><br>
<br>
<br>
On Jun 5, 2012, at 11:25 AM, Blaise Bourdin wrote:<br>
<br>
> Hi,<br>
><br>
> 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.<br>
><br>
> Is this something worth fixing?<br>
><br>
> Blaise<br>
><br>
> --<br>
> Department of Mathematics and Center for Computation & Technology<br>
> Louisiana State University, Baton Rouge, LA 70803, USA<br>
> Tel. <a href="tel:%2B1%20%28225%29%20578%201612" value="+12255781612">+1 (225) 578 1612</a>, Fax <a href="tel:%2B1%20%28225%29%20578%204276" value="+12255784276">+1 (225) 578 4276</a> <a href="http://www.math.lsu.edu/~bourdin" target="_blank">http://www.math.lsu.edu/~bourdin</a><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
<br>
</div></div></blockquote></div><br>