out of curiosity, why would you want to do that ? ----- Original Message -----
Is it easy to update ompi_datatype_is_valid to judge invalid datatypes, such as -1? Dahai On Fri, Jun 2, 2017 at 9:00 AM, Gilles Gouaillardet <gilles. gouaillar...@gmail.com> wrote: MPI_Datatype is a opaque handler, and -1 is a (signed) integer, so what you are trying is very likely to have an undefined behavior per the standard. if this seems to work with MPICH, this is not portable anyway, and will very likely cause a crash with OpenMPI Cheers, Gilles On Fri, Jun 2, 2017 at 10:41 PM, Dahai Guo <dahai....@gmail.com> wrote: > so you are saying that a user should NOT define send/recv data type as -1, > in openmpi? > > Dahai > > On Thu, Jun 1, 2017 at 6:59 PM, Gilles Gouaillardet <gilles@ rist.or.jp> > wrote: >> >> +1 >> >> >> MPI_Datatype is an opaque handler, and in Open MPI, this is an >> ompi_datatype_t * >> >> so we can only test for NULL pointers or MPI_DATATYPE_NULL that cannot be >> used per the standard. >> >> >> fwiw, and iirc, MPICH made an other design choice and MPI_ Datatype is a >> number, so the mpich equivalent of ompi_datatype_is_valid() >> >> might be able to handle random values without crashing. >> >> >> Cheers, >> >> >> Gilles >> >> >> On 6/2/2017 7:36 AM, George Bosilca wrote: >>> >>> You have to pass it an allocated datatype, and it tells you if the >>> pointer object is a valid MPI datatype for communications ( aka it has a >>> corresponding type with a well defined size, extent and alignment). >>> >>> There is no construct in C able to tell you if a random number if a valid >>> C "object". >>> >>> George. >>> >>> >>> On Thu, Jun 1, 2017 at 5:42 PM, Dahai Guo <dahai.guo@gmail. com >>> <mailto:dahai....@gmail.com>> wrote: >>> >>> Hi, >>> >>> if I insert following lines somewhere openmpi, such >>> as ompi/mpi/c/iscatter.c >>> >>> printf(" --- in MPI_Iscatter\n"); >>> //MPI_Datatype dt00 = (MPI_Datatype) MPI_INT; >>> *MPI_Datatype dt00 = (MPI_Datatype) -1;* >>> if(*!ompi_datatype_is_valid(dt00)* ) { >>> printf(" --- dt00 is NOT valid \n"); >>> } >>> >>> The attached test code will give the errors: >>> >>> *** Process received signal *** >>> Signal: Segmentation fault (11) >>> Signal code: Address not mapped (1) >>> Failing at address: 0xf >>> [ 0] [0x3fff9d480478] >>> ... >>> >>> Is it a bug in the function *ompi_datatype_is_valid(..) *? or I >>> miss something? >>> >>> Dahai >>> >>> _______________________________________________ >>> devel mailing list >>> devel@lists.open-mpi.org <mailto:de...@lists.open-mpi. org > >>> https://rfd.newmexicoconsortium.org/mailman/listinfo/devel >>> <https://rfd.newmexicoconsortium.org/mailman/listinfo/devel > >>> >>> >>> >>> >>> _______________________________________________ >>> devel mailing list >>> devel@lists.open-mpi.org >>> https://rfd.newmexicoconsortium.org/mailman/listinfo/devel >> >> >> _______________________________________________ >> devel mailing list >> devel@lists.open-mpi.org >> https://rfd.newmexicoconsortium.org/mailman/listinfo/devel > > > > _______________________________________________ > devel mailing list > devel@lists.open-mpi.org > https://rfd.newmexicoconsortium.org/mailman/listinfo/devel _______________________________________________ devel mailing list devel@lists.open-mpi.org https://rfd.newmexicoconsortium.org/mailman/listinfo/devel
_______________________________________________ devel mailing list devel@lists.open-mpi.org https://rfd.newmexicoconsortium.org/mailman/listinfo/devel