+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....@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:devel@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

Reply via email to