[Mpi-forum] MPI_Type_size question

Fab Tillier ftillier at microsoft.com
Fri Jun 18 11:55:08 CDT 2010

Hi Folks,

Looking at putting together the MPI_Count ticket, I ran across the following issue and was hoping to get some guidance.  Take the following code, using the current int counts, and assume sizeof(int) == 4, sizeof(MPI_DOUBLE) == 8:  

    MPI_Datatype myType;
    MPI_Type_contiguous( 1048576, MPI_DOUBLE, &myType );

    int size;
    MPI_Type_size( myType, &size );

Should MPI_Type_size return an error, due to overflow?  Does size get set to MPI_UNDEFINED and the call succeeds?

Similar issues exist for MPI_Pack with the outsize and position parameters, MPI_Unpack with the insize and position parameters, and MPI_Pack_size with the size parameter.

Lastly, it is my belief that these parameters should really be of type MPI_Aint, but changing this would break backward compatibility.  They cannot be of type MPI_Count, since overflow can occur if MPI_Count is defined as a C int.  How should the standard handle this?


More information about the mpi-forum mailing list