Sizeof (MPI_INT) other than sizeof (int)

I noticed that the size of int and double is different from those calculated using the MPI_Type_size function (MPI_INT, and MPI_INT_SIZE); Does this mean that sizeof (MPI_INT) returns the wrong value of 8? which usually should be 4 Thank you for your reply

+4
source share
1 answer

MPI_INT is an MPI type descriptor . It is used to instruct MPI to process the contents of the memory as intif it were reading when sending a message or writing when it received a message. It is not a language data type and cannot be used to declare variables. Using the size operator in the MPI handle is wrong, because it gives the size of the handle itself, not the size of the underlying data type. MPI handles are either integer indices in some table of MPI objects, in which case the size of this handle will be sizeof(int), or a pointer to an opaque data structure, in which case the size will be sizeof(void *). In a typical LP64 system, which will be 4 bytes and 8 bytes, respectively.

The same applies to all other pre-defined descriptors such as the MPI, such as MPI_FLOAT, MPI_DOUBLE, MPI_CHAR, etc.

+6

Source: https://habr.com/ru/post/1660537/


All Articles