mp_gatherv_zv Subroutine

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

Type IntentOptional Attributes Name
complex(kind=real_8), intent(in), DIMENSION(:), CONTIGUOUS :: sendbuf

Data to send to root

complex(kind=real_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

type(mp_comm_type), intent(in) :: comm

Message passing environment identifier


Source Code

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

         COMPLEX(kind=real_8), DIMENSION(:), CONTIGUOUS, INTENT(IN)      :: sendbuf
         !! Data to send to root
         COMPLEX(kind=real_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
         !! Process which gathers the data
         TYPE(mp_comm_type), INTENT(IN)           :: comm
         !! Message passing environment identifier

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

         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_DOUBLE_COMPLEX, &
                          recvbuf, recvcounts, displs, MPI_DOUBLE_COMPLEX, &
                          root, comm%handle, ierr)
         IF (ierr /= 0) CALL mp_stop(ierr, "mpi_gatherv @ "//routineN)
         CALL add_perf(perf_id=4, &
                       msg_size=sendcount*(2*real_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_zv