82. Canonical MPI_PACK and MPI_UNPACK


Up: Contents Next: Collective Communication Previous: Pack and Unpack

These functions read/write data to/from the buffer in the ``external32'' data format specified in Section External Data Representation: ``external32'' , and calculate the size needed for packing. Their first arguments specify the data format, for future extensibility, but currently the only valid value of the datarep argument is ``external32.''
Advice to users.

These functions could be used, for example, to send typed data in a portable format from one MPI implementation to another. ( End of advice to users.)

The buffer will contain exactly the packed data, without headers. MPI_BYTE should be used to send and receive data that is packed using MPI_PACK_EXTERNAL.


Rationale.

MPI_PACK_EXTERNAL specifies that there is no header on the message and further specifies the exact format of the data. Since MPI_PACK may (and is allowed to) use a header, the datatype MPI_PACKED cannot be used for data packed with MPI_PACK_EXTERNAL. ( End of rationale.)
MPI_PACK_EXTERNAL(datarep, inbuf, incount, datatype, outbuf, outsize, position )
IN datarepdata representation (string)
IN inbufinput buffer start (choice)
IN incountnumber of input data items (integer)
IN datatypedatatype of each input data item (handle)
OUT outbufoutput buffer start (choice)
IN outsizeoutput buffer size, in bytes (integer)
INOUT positioncurrent position in buffer, in bytes (integer)

int MPI_Pack_external(char *datarep, void *inbuf, int incount, MPI_Datatype datatype, void *outbuf, MPI_Aint outsize, MPI_Aint *position)

MPI_PACK_EXTERNAL(DATAREP, INBUF, INCOUNT, DATATYPE, OUTBUF, OUTSIZE, POSITION, IERROR)
INTEGER INCOUNT, DATATYPE, IERROR
INTEGER(KIND=MPI_ADDRESS_KIND) OUTSIZE, POSITION
CHARACTER*(*) DATAREP
<type> INBUF(*), OUTBUF(*)

void MPI::Datatype::Pack_external(const char* datarep, const void* inbuf, int incount, void* outbuf, MPI::Aint outsize, MPI::Aint& position) const

MPI_UNPACK_EXTERNAL(datarep, inbuf, insize, position, outbuf, outsize, position )
IN datarepdata representation (string)
IN inbufinput buffer start (choice)
IN insizeinput buffer size, in bytes (integer)
INOUT positioncurrent position in buffer, in bytes (integer)
OUT outbufoutput buffer start (choice)
IN outcountnumber of output data items (integer)
IN datatypedatatype of output data item (handle)
int MPI_Unpack_external(char *datarep, void *inbuf, MPI_Aint insize, MPI_Aint *position, void *outbuf, int outcount, MPI_Datatype datatype)

MPI_UNPACK_EXTERNAL(DATAREP, INBUF, INSIZE, POSITION, OUTBUF, OUTCOUNT, DATATYPE, IERROR)
INTEGER OUTCOUNT, DATATYPE, IERROR
INTEGER(KIND=MPI_ADDRESS_KIND) INSIZE, POSITION
CHARACTER*(*) DATAREP
<type> INBUF(*), OUTBUF(*)

void MPI::Datatype::Unpack_external(const char* datarep, const void* inbuf, MPI::Aint insize, MPI::Aint& position, void* outbuf, int outcount) const

MPI_PACK_EXTERNAL_SIZE( datarep, incount, datatype, size )
IN datarepdata representation (string)
IN incountnumber of input data items (integer)
IN datatypedatatype of each input data item (handle)
OUT sizeoutput buffer size, in bytes (integer)

int MPI_Pack_external_size(char *datarep, int incount, MPI_Datatype datatype, MPI_Aint *size)

MPI_PACK_EXTERNAL_SIZE(DATAREP, INCOUNT, DATATYPE, SIZE, IERROR)
INTEGER INCOUNT, DATATYPE, IERROR
INTEGER(KIND=MPI_ADDRESS_KIND) SIZE
CHARACTER*(*) DATAREP

MPI::Aint MPI::Datatype::Pack_external_size(const char* datarep, int incount) const



Up: Contents Next: Collective Communication Previous: Pack and Unpack


Return to MPI-2.1 Standard Index
Return to MPI Forum Home Page

MPI-2.0 of July 1, 2008
HTML Generated on July 6, 2008