mp_alltoall_c Subroutine

private subroutine mp_alltoall_c(sb, rb, count, group)

All-to-all data exchange, rank 1 arrays, equal sizes

Index meaning

The first two indices specify the data while the last index counts the processes

Sizes of ranks All processes have the same data size.

MPI mapping mpi_alltoall

Arguments

Type IntentOptional Attributes Name
complex(kind=real_4), intent(in), CONTIGUOUS :: sb(:)

array with data to send

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

array into which data is received

integer, intent(in) :: count

number of elements to send/receive (product of the extents of the first two dimensions)

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

Message passing environment identifier


Source Code

      SUBROUTINE mp_alltoall_c (sb, rb, count, group)
      !! All-to-all data exchange, rank 1 arrays, equal sizes
      !!
      !! Index meaning
      !!
      !! The first two indices specify the data while the last index counts
      !! the processes
      !!
      !! Sizes of ranks
      !! All processes have the same data size.
      !!
      !! MPI mapping
      !! mpi_alltoall

         COMPLEX(kind=real_4), CONTIGUOUS, INTENT(IN)        :: sb(:)
         !! array with data to send
         COMPLEX(kind=real_4), CONTIGUOUS, INTENT(OUT)       :: rb(:)
         !! array into which data is received
         INTEGER, INTENT(IN)                      :: count
         !! number of elements to send/receive (product of the extents of the first two dimensions)
         TYPE(mp_comm_type), INTENT(IN)           :: group
         !! Message passing environment identifier

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

         INTEGER                                  :: handle, ierr
#if defined(__parallel)
         INTEGER                                  :: msglen, np
#endif

         ierr = 0
         CALL timeset(routineN, handle)

#if defined(__parallel)
         CALL mpi_alltoall(sb, count, MPI_COMPLEX, &
                           rb, count, MPI_COMPLEX, group%handle, ierr)
         IF (ierr /= 0) CALL mp_stop(ierr, "mpi_alltoall @ "//routineN)
         CALL mpi_comm_size(group%handle, np, ierr)
         IF (ierr /= 0) CALL mp_stop(ierr, "mpi_comm_size @ "//routineN)
         msglen = 2*count*np
         CALL add_perf(perf_id=6, msg_size=msglen*(2*real_4_size))
#else
         MARK_USED(count)
         MARK_USED(group)
         rb = sb
#endif
         CALL timestop(handle)

      END SUBROUTINE mp_alltoall_c