allgatherv_complex_array_1to3_sub Subroutine

private subroutine allgatherv_complex_array_1to3_sub(arr, count, out, recvcnts, displs, sub_comm)

A subroutine to do a allgatherv operation, sending recvcnts(iproc) data from the iproc'th processor to all others starting at arr(start).

Arguments

Type IntentOptional Attributes Name
complex, intent(in), dimension(:) :: arr

The data to gather

integer, intent(in) :: count

How much data to gather, <=SIZE(arr)

complex, intent(out), dimension(:,:,:) :: out

The gathered data

integer, intent(in), dimension(:) :: recvcnts

Array detailing how much data to expect from each proc

integer, intent(in), dimension(:) :: displs

Array detailing offset in array where gathered data is to be stored

integer, intent(in) :: sub_comm

Sub-communicator handle


Contents


Source Code

  subroutine allgatherv_complex_array_1to3_sub(arr,count,out,recvcnts,displs,sub_comm)
    implicit none
    complex, dimension(:), intent(in) :: arr  !< The data to gather
    integer, intent(in) :: count !< How much data to gather, <=SIZE(arr)
    complex, dimension(:,:,:), intent(out) :: out !< The gathered data
    integer, dimension(:), intent(in) :: recvcnts !< Array detailing how much data to expect from each proc
    integer, dimension(:), intent(in) :: displs !< Array detailing offset in array where gathered data is to be stored
    integer, intent(in) :: sub_comm !< Sub-communicator handle
# ifdef MPI
    integer :: ierror
!$OMP MASTER
    call time_message(.false., time_mp_collectives, ' MPI Collectives')
!$OMP END MASTER
    !Do the gather
    call mpi_allgatherv(arr,count,mpicmplx,out,recvcnts,displs,&
         mpicmplx,sub_comm,ierror)
!$OMP MASTER
    call time_message(.false., time_mp_collectives, ' MPI Collectives')
!$OMP END MASTER
#else
    out=RESHAPE(arr,SHAPE(out))
#endif
  end subroutine allgatherv_complex_array_1to3_sub