IBM Books

MPI Subroutine Reference

MPI_PACK_EXTERNAL, MPI_Pack_external

Purpose

Packs the message in the specified send buffer into the specified buffer space, using the external32 data format.

C synopsis

#include <mpi.h>
int MPI_Pack_external(char *datarep, void *inbuf, int incount, 
		      MPI_Datatype datatype, void *outbuf, 
		      MPI_Aint outsize, MPI_Aint *position);

C++ synopsis

#include mpi.h
void MPI::Datatype::Pack_external(const char* datarep, const void* inbuf, 
				  int incount, void* outbuf, MPI::Aint outsize, 
				  MPI_Aint& position) const;

FORTRAN synopsis

include 'mpif.h' or use mpi
MPI_PACK_EXTERNAL(CHARACTER*(*) DATAREP, CHOICE INBUF(*), INTEGER INCOUNT, 
		  INTEGER DATATYPE, CHOICE OUTBUF(*), INTEGER(KIND=MPI_ADDRESS_KIND)  OUTSIZE, 
		  INTEGER(KIND=MPI_ADDRESS_KIND) POSITION, INTEGER IERROR)

Parameters

datarep
is the data representation (string) (IN)

inbuf
is the input buffer start (choice) (IN)

incount
is an integer specifying the number of input data items (IN)

datatype
is the datatype of each input data item (handle) (IN)

outbuf
is the output buffer start (choice) (OUT)

outsize
is an integer specifying the output buffer size, in bytes (IN)

position
is the current position in the output buffer, in bytes (integer) (INOUT)

IERROR
is the FORTRAN return code. It is always the last argument.

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.

Notes

In FORTRAN, MPI_PACK_EXTERNAL returns an argument of type INTEGER(KIND=MPI_ADDRESS_KIND), where type MPI_Aint is used in C. Such variables may be declared as INTEGER*4 in purely 32-bit codes and as INTEGER*8 in 64-bit codes; KIND=MPI_ADDRESS_KIND works correctly in either mode.

Errors

Invalid datarep

Invalid datatype

Invalid incount
incount < 0

Negative length or position for buffer
outsize < 0 or position < 0

Outbuf too small

Type not committed

MPI already finalized

MPI not initialized

Related information

MPI_PACK_EXTERNAL_SIZE
MPI_UNPACK_EXTERNAL


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]