mp_gather_c Subroutine

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

Gathers a datum from all processes to one

MPI mapping mpi_gather

Arguments

TypeIntentOptionalAttributesName
complex(kind=real_4), intent(in) :: msg

Datum to send to root

complex(kind=real_4), intent(out), CONTIGUOUS:: msg_gather(:)

Received data (on root)

integer, intent(in) :: root

Process which gathers the data Message passing environment identifier

integer, intent(in) :: gid

Process which gathers the data Message passing environment identifier


Contents

Source Code


Source Code

      SUBROUTINE mp_gather_c (msg, msg_gather, root, gid)
      !! Gathers a datum from all processes to one
      !!
      !! MPI mapping
      !! mpi_gather

         COMPLEX(kind=real_4), INTENT(IN)                    :: msg
         !! Datum to send to root
         COMPLEX(kind=real_4), CONTIGUOUS, INTENT(OUT)       :: msg_gather(:)
         !! Received data (on root)
         INTEGER, INTENT(IN)                      :: root, gid
         !! Process which gathers the data
         !! Message passing environment identifier

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

         INTEGER                                  :: handle, ierr, msglen

         ierr = 0
         CALL timeset(routineN, handle)

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