Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

sizeof(MPI_INT) different from sizeof(int)

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

like image 358
JimBamFeng Avatar asked Nov 11 '16 18:11

JimBamFeng


1 Answers

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.

like image 191
Hristo Iliev Avatar answered Sep 19 '22 18:09

Hristo Iliev