Purpose
Packs the message in the specified send buffer into the specified buffer space.
C synopsis
#include <mpi.h> int MPI_Pack(void* inbuf,int incount,MPI_Datatype datatype, void *outbuf,int outsize,int *position,MPI_Comm comm);
C++ synopsis
#include mpi.h void MPI::Datatype::Pack(const void* inbuf, int incount, void* outbuf, int outsize, int& position, const MPI::Comm& comm) const;
FORTRAN synopsis
include 'mpif.h' or use mpi MPI_PACK(CHOICE INBUF,INTEGER INCOUNT,INTEGER DATATYPE,CHOICE OUTBUF, INTEGER OUTSIZE,INTEGER POSITION,INTEGER COMM,INTEGER IERROR)
Parameters
Description
This subroutine packs the message specified by inbuf, incount, and datatype into the buffer space specified by outbuf and outsize. The input buffer is any communication buffer allowed in MPI_SEND. The output buffer is any contiguous storage space containing outsize bytes and starting at the address outbuf.
The input value of position is the beginning offset in the output buffer that will be used for packing. The output value of position is the offset in the output buffer following the locations occupied by the packed message. comm is the communicator that will be used for sending the packed message.
Notes
MPI_PACK must be used with some care in 64-bit applications because outsize and position are integers and can be subject to overflow.
Errors
Related information