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 wrote:
MPI_Datatype is a opaque handler, and -1 i
As George pointed out earlier, there is no construct in C able to tell
you if a random number is a valid C pointer, i.e., is a valid memory
address. -1, once casted to a pointer, would correspond to the adress
0x...f .
It would probably be better to ajust the initial code in order to use
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 hav
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, 201
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
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_
+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
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".
Ge
Hi,
did you check the source code for ompi_datatype_is_valid() ?
MPI_Datatype is an opaque handler.
in Open MPI, this is an ompi_datatype_t *;
iirc, ompi_datatype_is_valid() test for a NULL pointer, or MPI_DATATYPE_
NULL.
in your case, you forced an invalid pointer, so the behavior is
undefin
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