mp_gatherv_lv Subroutine

private subroutine mp_gatherv_lv(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

Arguments

TypeIntentOptionalAttributesName
integer(kind=int_8), intent(in), DIMENSION(:), CONTIGUOUS:: sendbuf

Data to send to root

integer(kind=int_8), 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 Message passing environment identifier

integer, intent(in) :: comm

Process which gathers the data Message passing environment identifier


Contents

Source Code


Source Code

      SUBROUTINE mp_gatherv_lv(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

         INTEGER(KIND=int_8), DIMENSION(:), CONTIGUOUS, INTENT(IN)      :: sendbuf
         !! Data to send to root
         INTEGER(KIND=int_8), 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, comm
         !! Process which gathers the data
         !! Message passing environment identifier

         CHARACTER(LEN=*), PARAMETER :: routineN = 'mp_gatherv_lv'

         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_INTEGER8, &
                          recvbuf, recvcounts, displs, MPI_INTEGER8, &
                          root, comm, ierr)
         IF (ierr /= 0) CALL mp_stop(ierr, "mpi_gatherv @ "//routineN)
         CALL add_perf(perf_id=4, &
                       msg_size=sendcount*int_8_size)
#else
         MARK_USED(recvcounts)
         MARK_USED(root)
         MARK_USED(comm)
         recvbuf(1 + displs(1):) = sendbuf
#endif
         CALL timestop(handle)
      END SUBROUTINE mp_gatherv_lv