: MPI_Gather, MPI_Allgather, MPI_Gatherv, MPI_Allgatherv. .
MPI_Gather , , root. . -. , i sendbuf, i- recvbuf root. , , .
:
int MPI_Gather(void* sendbuf, int sendcount, MPI_Datatype sendtype,
void* recvbuf, int recvcount, MPI_Datatype recvtype,
int root, MPI_Comm comm)
IN | sendbuf | - | ; |
IN | sendcount | - | ; |
IN | sendtype | - | ; |
OUT | recvbuf | - | ( - root); |
IN | recvcount | - | , ( - root); |
IN | recvtype | - | ; |
IN | root | - | -; |
IN | comm | - | . |
sendtype recvtype , sendcount recvcount. , recvcount root - , . Gather . 4.2.
. 4.2. Gather.
MPI_Gather.
MPI_Comm comm;int array[100];int root, *rbuf;...MPI_Comm_size(comm, &gsize);rbuf = (int *) malloc(gsize * 100 * sizeof(int));MPI_Gather(array, 100, MPI_INT, rbuf, 100, MPI_INT, root, comm);MPI_Allgather , MPI_Gather, . , i sendbuf, i- recvbuf . recvbuf .
C:
int MPI_Allgather(void* sendbuf, int sendcount, MPI_Datatype sendtype,
void* recvbuf, int recvcount, MPI_Datatype recvtype, MPI_Comm comm)
IN | sendbuf | - | ; |
IN | sendcount | - | ; |
IN | sendtype | - | ; |
OUT | recvbuf | - | ; |
IN | recvcount | - | , ; |
IN | recvtype | - | ; |
IN | comm | - | . |
Allgater 4.3. Y , X .
4.3. llgather.
|
|
MPI_Gatherv , , , recvcounts. -, displs.
C:
int MPI_Gatherv(void* sendbuf, int sendcount, MPI_Datatype sendtype,
void* rbuf, int *recvcounts, int *displs, MPI_Datatype recvtype,
int root, MPI_Comm comm)
IN | sendbuf | - | ; |
IN | sendcount | - | ; |
IN | sendtype | - | ; |
OUT | rbuf | - | ; |
IN | recvcounts | - | ( ), i- , i; |
IN | displs | - | ( ), i- i- rbuf; |
IN | recvtype | - | ; |
IN | root | - | -; |
IN | comm | - | . |
root , , , i, root, rbuf + displs[i]. Gatherv . 4.4.
. 4.4. Gatherv.
MPI_Allgatherv MPI_Gatherv, . root.
C:
int MPI_Allgatherv(void* sendbuf, int sendcount, MPI_Datatype sendtype,
void* rbuf, int *recvcounts, int *displs,
MPI_Datatype recvtype, MPI_Comm comm)
IN | sendbuf | - | ; |
IN | sendcount | - | ; |
IN | sendtype | - | ; |
OUT | rbuf | - | ; |
IN | recvcounts | - | ( ), , ; |
IN | displs | - | ( ), i- rbuf i- ; |
IN | recvtype | - | ; |
IN | comm | - | . |