Gathers data from all processes to one.
Data length Data can have different lengths
Offsets Offsets start at 0
MPI mapping mpi_gather
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=real_4), | intent(in), | DIMENSION(:), CONTIGUOUS | :: | sendbuf |
Data to send to root |
|
real(kind=real_4), | intent(out), | DIMENSION(:), CONTIGUOUS | :: | recvbuf |
Received data (on root) |
|
integer, | intent(in), | DIMENSION(:), CONTIGUOUS | :: | recvcounts |
Sizes of data received from processes Offsets of data received from processes |
|
integer, | intent(in), | DIMENSION(:), CONTIGUOUS | :: | displs |
Sizes of data received from processes Offsets of data received from processes |
|
integer, | intent(in) | :: | root |
Process which gathers the data |
||
type(mp_comm_type), | intent(in) | :: | comm |
Message passing environment identifier |
SUBROUTINE mp_gatherv_rv(sendbuf, recvbuf, recvcounts, displs, root, comm) !! Gathers data from all processes to one. !! !! Data length !! Data can have different lengths !! !! Offsets !! Offsets start at 0 !! !! MPI mapping !! mpi_gather REAL(kind=real_4), DIMENSION(:), CONTIGUOUS, INTENT(IN) :: sendbuf !! Data to send to root REAL(kind=real_4), DIMENSION(:), CONTIGUOUS, INTENT(OUT) :: recvbuf !! Received data (on root) INTEGER, DIMENSION(:), CONTIGUOUS, INTENT(IN) :: recvcounts, displs !! Sizes of data received from processes !! Offsets of data received from processes INTEGER, INTENT(IN) :: root !! Process which gathers the data TYPE(mp_comm_type), INTENT(IN) :: comm !! Message passing environment identifier CHARACTER(LEN=*), PARAMETER :: routineN = 'mp_gatherv_rv' INTEGER :: handle, ierr #if defined(__parallel) INTEGER :: sendcount #endif ierr = 0 CALL timeset(routineN, handle) #if defined(__parallel) sendcount = SIZE(sendbuf) CALL mpi_gatherv(sendbuf, sendcount, MPI_REAL, & recvbuf, recvcounts, displs, MPI_REAL, & root, comm%handle, ierr) IF (ierr /= 0) CALL mp_stop(ierr, "mpi_gatherv @ "//routineN) CALL add_perf(perf_id=4, & msg_size=sendcount*real_4_size) #else MARK_USED(recvcounts) MARK_USED(root) MARK_USED(comm) recvbuf(1 + displs(1):) = sendbuf #endif CALL timestop(handle) END SUBROUTINE mp_gatherv_rv