all_gather Function

public function all_gather(local) result(global)

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: local

Return Value character(len=:), allocatable


Calls

proc~~all_gather~~CallsGraph proc~all_gather all_gather mpi_allgather mpi_allgather proc~all_gather->mpi_allgather mpi_allgatherv mpi_allgatherv proc~all_gather->mpi_allgatherv

Called by

proc~~all_gather~~CalledByGraph proc~all_gather all_gather proc~regrid regrid proc~regrid->proc~all_gather proc~write_data~2 RegridSupport%write_data proc~write_data~2->proc~regrid program~main~17 main program~main~17->proc~write_data~2

Source Code

   function all_gather(local) result(global)
      character(len=*), intent(in) :: local
      character(len=:), allocatable :: global

      integer :: p
      integer, allocatable :: counts(:)
      integer, allocatable :: displs(:)
      integer :: ierror

      allocate(counts(0:pet_count-1))
      allocate(displs(0:pet_count-1))

      call mpi_allgather(len(local), 1, MPI_INTEGER, &
           & counts, 1, MPI_INTEGER, MPI_COMM_WORLD, ierror)

      displs(0) = 0
      do p = 1, pet_count - 1
          displs(p) = displs(p-1) + counts(p-1)
      end do

      allocate(character(len=sum(counts)) :: global)
      call mpi_allgatherv(local, len(local), MPI_CHAR, &
           global, counts, displs, MPI_CHAR, MPI_COMM_WORLD, ierror)

   end function all_gather