mp_gather_rm Subroutine

private subroutine mp_gather_rm(msg, msg_gather, root, gid)

Gathers data from all processes to one

Data length All data (msg) is equal-sized

MPI mapping mpi_gather

Note

see mp_gather_r

Arguments

Type IntentOptional Attributes Name
real(kind=real_4), intent(in), CONTIGUOUS :: msg(:,:)

Datum to send to root

real(kind=real_4), intent(out), CONTIGUOUS :: msg_gather(:,:)
integer, intent(in) :: root
type(mp_comm_type), intent(in) :: gid

Source Code

      SUBROUTINE mp_gather_rm(msg, msg_gather, root, gid)
      !! Gathers data from all processes to one
      !!
      !! Data length
      !! All data (msg) is equal-sized
      !!
      !! MPI mapping
      !! mpi_gather
      !! @note see mp_gather_r

         REAL(kind=real_4), CONTIGUOUS, INTENT(IN)        :: msg(:, :)
         !! Datum to send to root
         REAL(kind=real_4), CONTIGUOUS, INTENT(OUT)       :: msg_gather(:, :)
         INTEGER, INTENT(IN)                      :: root
         TYPE(mp_comm_type), INTENT(IN)           :: gid

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

         INTEGER                                  :: handle, ierr, msglen

         ierr = 0
         CALL timeset(routineN, handle)

         msglen = SIZE(msg)
#if defined(__parallel)
         CALL mpi_gather(msg, msglen, MPI_REAL, msg_gather, &
                         msglen, MPI_REAL, root, gid%handle, ierr)
         IF (ierr /= 0) CALL mp_stop(ierr, "mpi_gather @ "//routineN)
         CALL add_perf(perf_id=4, msg_size=msglen*real_4_size)
#else
         MARK_USED(root)
         MARK_USED(gid)
         msg_gather = msg
#endif
         CALL timestop(handle)
      END SUBROUTINE mp_gather_rm