[mpich-devel] MPI_Pack/MPI_Unpack/MPI_Pack_size and large datatypes

Rob Latham robl at mcs.anl.gov
Fri Oct 18 16:40:29 CDT 2013

No one on the mpi forum had much to say when I mentioned the oddity
that is MPI_Pack:  'int' used to describe position in a bytestream.
'int' used to describe a memory address...

When Jeff brought up MPI_Pack a year ago, the response was "it took us
3 years to do MPI_Count.  we're not touching MPI_Pack".  Fair enough.

Except! the practice of packing mpi datatypes into a contiguous buffer
is rather common in the MPICH code.

I propose promoting the 'outsize', 'position' and 'size' parameters of
the internal routines (MPIR_Pack_impl, MPIR_Unpack_impl,
MPIR_Pack_size_impl) to MPI_Aint:

int MPIR_Pack_impl(const void *inbuf, int incount, MPI_Datatype
datatype, void *outbuf, MPI_Aint outcount, MPI_Aint *position);

void MPIR_Pack_size_impl(int incount, MPI_Datatype datatype,
        MPI_Aint *size);

int MPIR_Unpack_impl(const void *inbuf, MPI_Aint insize,
	MPI_Aint *position, void *outbuf, int outcount,
	MPI_Datatype datatype);

I would have used MPI_Count, but Dave and Jim had some concerns about
128-bit math in places.   Is pack/unpack ever on the critical path?

I've added this change to the
mpich-review/large-count-large-typesize-combo review branch.


Rob Latham
Mathematics and Computer Science Division
Argonne National Lab, IL USA

More information about the devel mailing list