I noticed that the sized of the int and double are different that the ones that are calculated using the function MPI_Type_size(MPI_INT, &MPI_INT_SIZE); Does that mean sizeof(MPI_INT) returns the wrong value of 8?? which it should normally be 4 Thanks for your reply
MPI_INT
is an MPI type handle. It is used to tell MPI to treat the memory content as int
when reading while sending a message or writing while receiving a message. It is not a language data type and cannot be used to declare variables. Using the size-of operator on an MPI handle is wrong as it gives the size of the handle itself and not the size of the underlying datatype. MPI handles are either integer indexes into some table of MPI objects, in which case the size-of that handle will be sizeof(int)
, or a pointer to an opaque data structure, in which case the size-of will be sizeof(void *)
. On a typical LP64 system that will be 4 bytes and 8 bytes respectively.
The same applies to every other predefined MPI datatype handle, such as MPI_FLOAT
, MPI_DOUBLE
, MPI_CHAR
, and so on.
© 2022 - 2024 — McMap. All rights reserved.