allgather_integer_array_1to1 Subroutine

private subroutine allgather_integer_array_1to1(arr, count, out, recvcnts)

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
integer, intent(in), dimension(:) :: arr

The data to gather

integer, intent(in) :: count

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

integer, intent(out), dimension(:) :: out

The gathered data

integer, intent(in) :: recvcnts

Array detailing how much data to expect from each proc


Contents


Source Code

  subroutine allgather_integer_array_1to1(arr,count,out,recvcnts)
    implicit none
    integer, dimension(:), intent(in) :: arr  !< The data to gather
    integer, intent(in) :: count !< How much data to gather, <=SIZE(arr)
    integer, dimension(:), intent(out) :: out !< The gathered data
    integer, intent(in) :: recvcnts !< Array detailing how much data to expect from each proc
# ifdef MPI
    integer :: ierror
!$OMP MASTER
    call time_message(.false., time_mp_collectives, ' MPI Collectives')
!$OMP END MASTER

    !Do the gather
    call mpi_allgather(arr,count,MPI_INTEGER,out,recvcnts,&
         MPI_INTEGER,mp_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 allgather_integer_array_1to1