<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Sep 15, 2014 at 1:08 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>
  Matt,<br>
<br>
   I ran with OpenMPI and got exactly the error you’d expect and what they reported "An error occurred in MPI_Type_size”. A simple use of the debugger would reveal where it happened. I suspect that MPICH is more generous when you call MPI_Type_size() with a null type, perhaps it just gives a size of zero.<br>
<br>
   I hunted around on the web and could not find a definitive statement of what MPI_Type_size() should do when passed an argument of a null datatype.<br></blockquote><div><br></div><div>Evidently, standards will only get you so far.</div><div><br></div><div>   Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
   Barry<br>
<br>
On Sep 15, 2014, at 4:40 AM, Matthew Knepley <<a href="mailto:knepley@gmail.com">knepley@gmail.com</a>> wrote:<br>
<br>
> On Sun, Sep 14, 2014 at 8:36 PM, Barry Smith <<a href="mailto:bsmith@mcs.anl.gov">bsmith@mcs.anl.gov</a>> wrote:<br>
><br>
>    Pierre,<br>
><br>
>      Thanks for reporting this, it is, indeed our bug. In petsclog.h we have macros for the various MPI calls in order to log their usage, for example,<br>
><br>
> #define MPI_Scatter(sendbuf,sendcount,sendtype,recvbuf,recvcount,recvtype,root,comm) \<br>
>  ((petsc_scatter_ct++,0) || PetscMPITypeSize(&petsc_recv_len,recvcount,recvtype) || MPI_Scatter(sendbuf,sendcount,sendtype,recvbuf,recvcount,recvtype,root,comm))<br>
><br>
> but PetscMPITypeSize() simply called MPI_Type_size() which generated an MPI error for MPI_DATATYPE_NULL<br>
><br>
> PETSC_STATIC_INLINE PetscErrorCode PetscMPITypeSize(PetscLogDouble *buff,PetscMPIInt count,MPI_Datatype type)<br>
> {<br>
>   PetscMPIInt mysize; return  (MPI_Type_size(type,&mysize) || ((*buff += (PetscLogDouble) (count*mysize)),0));<br>
> }<br>
><br>
> What error did you get? Why did I not get this error when I ran it? I ran with MPICH 3.0.4 since that was the one I had compiled for C++.<br>
><br>
>   Matt<br>
><br>
> In the branch barry/fix-usage-with-mpidatatypenull I have added a check for this special case and avoid the MPI_Type_size() call. I will put this branch into next and if all tests pass it will be merged into maint and master and be in the next patch release.<br>
><br>
>    Thank you for reporting the problem.<br>
><br>
>    Barry<br>
><br>
> Barry still thinks MPI 1.1 is the height of HPC computing :-(<br>
><br>
><br>
><br>
> On Sep 14, 2014, at 4:16 PM, Pierre Jolivet <<a href="mailto:jolivet@ann.jussieu.fr">jolivet@ann.jussieu.fr</a>> wrote:<br>
><br>
> > Hello,<br>
> > Could you please explain to me why the following example is not working properly when <petsc.h> (from master, with OpenMPI 1.8.1) is included ?<br>
> ><br>
> > $ mpicxx in-place.cpp  -I$PETSC_DIR/include -I$PETSC_DIR/$PETSC_ARCH/include -L$PETSC_DIR/$PETSC_ARCH/lib -lpetsc<br>
> > $ mpirun -np 2 ./a.out<br>
> > Done with the scatter !<br>
> > 0 0 0 0 (this line should be filled with 0)<br>
> > 1 1 1 1 (this line should be filled with 1)<br>
> > Done with the gather !<br>
> ><br>
> > $ mpicxx in-place.cpp  -I$PETSC_DIR/include -I$PETSC_DIR/$PETSC_ARCH/include -L$PETSC_DIR/$PETSC_ARCH/lib -lpetsc -DPETSC_BUG<br>
> > $ mpirun -np 2 ./a.out<br>
> > [:3367] *** An error occurred in MPI_Type_size<br>
> > [:3367] *** reported by process [4819779585,140733193388032]<br>
> > [:3367] *** on communicator MPI_COMM_WORLD<br>
> > [:3367] *** MPI_ERR_TYPE: invalid datatype<br>
> > [:3367] *** MPI_ERRORS_ARE_FATAL (processes in this communicator will now abort,<br>
> > [:3367] ***    and potentially your MPI job)<br>
> ><br>
> > Thank you for looking,<br>
> > Pierre<br>
> ><br>
> > <in-place.cpp><br>
><br>
><br>
><br>
<span class="HOEnZb"><font color="#888888">><br>
> --<br>
> What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>
> -- Norbert Wiener<br>
<br>
</font></span></blockquote></div><br><br clear="all"><div><br></div>-- <br>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener
</div></div>