mp_allgather_d12 Subroutine

private subroutine mp_allgather_d12(msgout, msgin, gid)

Gathers vector data from all processes and all processes receive the same data

Data size All processes send equal-sized data

Ranks The last rank counts the processes

MPI mapping mpi_allgather

Arguments

Type IntentOptional Attributes Name
real(kind=real_8), intent(in), CONTIGUOUS :: msgout(:)

Rank-1 data to send

real(kind=real_8), intent(out), CONTIGUOUS :: msgin(:,:)

Received data

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

Message passing environment identifier


Source Code

      SUBROUTINE mp_allgather_d12(msgout, msgin, gid)
      !! Gathers vector data from all processes and all processes receive the
      !! same data
      !!
      !! Data size
      !! All processes send equal-sized data
      !!
      !! Ranks
      !! The last rank counts the processes
      !!
      !! MPI mapping
      !! mpi_allgather

         REAL(kind=real_8), CONTIGUOUS, INTENT(IN)        :: msgout(:)
         !! Rank-1 data to send
         REAL(kind=real_8), CONTIGUOUS, INTENT(OUT)       :: msgin(:, :)
         !! Received data
         TYPE(mp_comm_type), INTENT(IN)                      :: gid
         !! Message passing environment identifier

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

         INTEGER                                  :: handle, ierr
#if defined(__parallel)
         INTEGER                                  :: rcount, scount
#endif

         ierr = 0
         CALL timeset(routineN, handle)

#if defined(__parallel)
         scount = SIZE(msgout(:))
         rcount = scount
         CALL MPI_ALLGATHER(msgout, scount, MPI_DOUBLE_PRECISION, &
                            msgin, rcount, MPI_DOUBLE_PRECISION, &
                            gid%handle, ierr)
         IF (ierr /= 0) CALL mp_stop(ierr, "mpi_allgather @ "//routineN)
#else
         MARK_USED(gid)
         msgin(:, 1) = msgout(:)
#endif
         CALL timestop(handle)
      END SUBROUTINE mp_allgather_d12