📄 mpi_alltoall.3
字号:
.\"Copyright 2006, Sun Microsystems, Inc..\" Copyright (c) 1996 Thinking Machines Corporation.TH MPI_Alltoall 3OpenMPI "September 2006" "Open MPI 1.2" " ".SH NAME\fBMPI_Alltoall\fP \- All processes send data to all processes .SH SYNTAX.ft R.SH C Syntax.nf#include <mpi.h>int MPI_Alltoall(void *\fIsendbuf\fP, int \fIsendcount\fP, MPI_Datatype \fIsendtype\fP, void *\fIrecvbuf\fP, int \fIrecvcount\fP, MPI_Datatype \fIrecvtype\fP, MPI_Comm \fIcomm\fP).SH Fortran Syntax.nfINCLUDE 'mpif.h'MPI_ALLTOALL(\fISENDBUF, SENDCOUNT, SENDTYPE, RECVBUF, RECVCOUNT, RECVTYPE, COMM, IERROR\fP) <type> \fISENDBUF(*), RECVBUF(*)\fP INTEGER \fISENDCOUNT, SENDTYPE, RECVCOUNT, RECVTYPE\fP INTEGER \fICOMM, IERROR\fP.SH C++ Syntax.nf#include <mpi.h>void MPI::Comm::Alltoall(const void* \fIsendbuf\fP, int \fIsendcount\fP, const MPI::Datatype& \fIsendtype\fP, void* \fIrecvbuf\fP, int \fIrecvcount\fP, const MPI::Datatype& \fIrecvtype\fP).SH INPUT PARAMETERS.ft R.TP 1.2isendbufStarting address of send buffer (choice)..TP 1.2isendcountNumber of elements to send to each process (integer)..TP 1.2isendtypeDatatype of send buffer elements (handle)..TP 1.2irecvcountNumber of elements to receive from each process (integer)..TP 1.2irecvtypeDatatype of receive buffer elements (handle)..TP 1.2icommCommunicator over which data is to be exchanged (handle)..SH OUTPUT PARAMETERS.ft R.TP 1.2irecvbufStarting address of receive buffer (choice)..ft R.TP 1.2iIERRORFortran only: Error status (integer). .SH DESCRIPTION.ft RMPI_Alltoall is a collective operation in which all processes send the same amount of data to each other, and receive the same amount of data from each other. The operation of this routine can be represented as follows, where each process performs 2n (n being the number of processes in communicator \fIcomm\fP) independent point-to-point communications (including communication with itself)..sp.nf MPI_Comm_size(\fIcomm\fP, &n); for (i = 0, i < n; i++) MPI_Send(\fIsendbuf\fP + i * \fIsendcount\fP * extent(\fIsendtype\fP), \fIsendcount\fP, \fIsendtype\fP, i, ..., \fIcomm\fP); for (i = 0, i < n; i++) MPI_Recv(\fIrecvbuf\fP + i * \fIrecvcount\fP * extent(\fIrecvtype\fP), \fIrecvcount\fP, \fIrecvtype\fP, i, ..., \fIcomm\fP);.fi.spEach process breaks up its local \fIsendbuf\fP into n blocks \- eachcontaining \fIsendcount\fP elements of type \fIsendtype\fP \- anddivides its \fIrecvbuf\fP similarly according to \fIrecvcount\fP and\fIrecvtype\fP. Process j sends the k-th block of its local\fIsendbuf\fP to process k, which places the data in the j-th block ofits local \fIrecvbuf\fP. The amount of data sent must be equal to theamount of data received, pairwise, between every pair of processes.WHEN COMMUNICATOR IS AN INTER-COMMUNICATOR.spWhen the communicator is an inter-communicator, the gather operation occurs in two phases. The data is gathered from all the members of the first group and received by all the members of the second group. Then the data is gathered from all the members of the second group and received by all the members of the first. The operation exhibits a symmetric, full-duplex behavior. .spThe first group defines the root process. The root process uses MPI_ROOT as the value of \fIroot\fR. All other processes in the first group use MPI_PROC_NULL as the value of \fIroot\fR. All processes in the second group use the rank of the root process in the first group as the value of \fIroot\fR..spWhen the communicator is an intra-communicator, these groups are the same, and the operation occurs in a single phase..sp .SH NOTES.ft RThe MPI_IN_PLACE option is not available for this function..spAll arguments on all processes are significant. The \fIcomm\fP argument,in particular, must describe the same communicator on all processes..spThere are two MPI library functions that are more general thanMPI_Alltoall. MPI_Alltoallv allows all-to-all communication to andfrom buffers that need not be contiguous; different processes maysend and receive different amounts of data. MPI_Alltoallw expandsMPI_Alltoallv's functionality to allow the exchange of data withdifferent datatypes..SH ERRORS.ft RAlmost all MPI routines return an error value; C routines asthe value of the function and Fortran routines in the last argument. C++functions do not return errors. If the default error handler is set toMPI::ERRORS_THROW_EXCEPTIONS, then on error the C++ exception mechanismwill 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 forI/O function errors. The error handler may be changed withMPI_Comm_set_errhandler; the predefined error handler MPI_ERRORS_RETURNmay be used to cause error values to be returned. Note that MPI does notguarantee that an MPI program can continue past an error. .SH SEE ALSO.ft R.nfMPI_AlltoallvMPI_Alltoallw' @(#)MPI_Alltoall.3 1.25 06/03/09
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -