📄 mpi_pack.3
字号:
.\"Copyright 2006, Sun Microsystems, Inc..\" Copyright (c) 1996 Thinking Machines Corporation.TH MPI_Pack 3OpenMPI "September 2006" "Open MPI 1.2" " ".SH NAME\fBMPI_Pack\fP \- Packs data of a given datatype into contiguous memory..SH SYNTAX.ft R.SH C Syntax.nf#include <mpi.h>int MPI_Pack(void *\fIinbuf\fP, int\fI incount\fP, MPI_Datatype\fI datatype\fP, void\fI *outbuf\fP, int\fI outsize\fP, int\fI *position\fP, MPI_Comm\fI comm\fP).SH Fortran Syntax.nfINCLUDE 'mpif.h'MPI_PACK(\fIINBUF, INCOUNT, DATATYPE, OUTBUF,OUTSIZE, POSITION, COMM, IERROR\fP) <type> \fIINBUF(*), OUTBUF(*)\fP INTEGER \fIINCOUNT, DATATYPE, OUTSIZE, POSITION, COMM, IERROR\fP .SH C++ Syntax.nf#include <mpi.h>void Datatype::Pack(const void* \fIinbuf\fP, int \fIincount\fP, void *\fIoutbuf\fP, int \fIoutsize\fP, int& \fIposition\fP, const Comm &\fIcomm\fP) const .SH INPUT PARAMETERS.ft R.TP 1iinbufInput buffer start (choice)..TP 1iincountNumber of input data items (integer)..TP 1idatatypeDatatype of each input data item (handle)..TP 1ioutsizeOutput buffer size, in bytes (integer)..TP 1icommCommunicator for packed message (handle)..SH INPUT/OUTPUT PARAMETER.ft R.TP 1ipositionCurrent position in buffer, in bytes (integer)..SH OUTPUT PARAMETERS.ft R.TP 1ioutbufOutput buffer start (choice)..ft R.TP 1iIERRORFortran only: Error status (integer). .SH DESCRIPTION.ft RPacks the message in the send buffer specified by \fIinbuf\fP, \fIincount\fP, \fIdatatype\fP into the buffer space specified by \fIoutbuf\fP and \fIoutsize\fP. The input buffer can be any communication buffer allowed in MPI_Send. The output buffer is a contiguous storage area containing \fIoutsize\fP bytes, starting at the address \fIoutbuf\fP (length is counted in bytes, not elements, as if it were a communication buffer for a message of type MPI_Packed)..spThe input value of \fIposition\fP is the first location in the output buffer to be used for packing. \fIposition\fP is incremented by the size of the packed message, and the output value of \fIposition\fP is the first location in the output buffer following the locations occupied by the packed message. The \fIcomm\fP argument is the communicator that will be subsequently used for sending the packed message..sp\fBExample:\fP An example using MPI_Pack:.sp.nf int position, i, j, a[2]; char buff[1000]; \&.... MPI_Comm_rank(MPI_COMM_WORLD, &myrank); if (myrank == 0) { / * SENDER CODE */ position = 0; MPI_Pack(&i, 1, MPI_INT, buff, 1000, &position, MPI_COMM_WORLD); MPI_Pack(&j, 1, MPI_INT, buff, 1000, &position, MPI_COMM_WORLD); MPI_Send( buff, position, MPI_PACKED, 1, 0, MPI_COMM_WORLD); } else /* RECEIVER CODE */ MPI_Recv( a, 2, MPI_INT, 0, 0, MPI_COMM_WORLD) }.SH ERRORSAlmost all MPI routines return an error value; C routines as the value of the function and Fortran routines in the last argument. C++ functions do not return errors. If the default error handler is set to MPI::ERRORS_THROW_EXCEPTIONS, then on error the C++ exception mechanism will be used to throw an MPI:Exception object..spBefore the error value is returned, the current MPI error handler iscalled. By default, this error handler aborts the MPI job, except for I/O function errors. The error handler may be changed with MPI_Comm_set_errhandler; the predefined error handler MPI_ERRORS_RETURN may be used to cause error values to be returned. Note that MPI does not guarantee that an MPI program can continue past an error. .SH SEE ALSO.ft RMPI_Unpack.brMPI_Pack_size' @(#)MPI_Pack.3 1.20 06/03/09
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -