flow_allgather_owned_scalar Subroutine

public subroutine flow_allgather_owned_scalar(flow, local_global, global)

Uses

  • proc~~flow_allgather_owned_scalar~~UsesGraph proc~flow_allgather_owned_scalar mod_mpi_flow::flow_allgather_owned_scalar module~mod_profiler mod_profiler proc~flow_allgather_owned_scalar->module~mod_profiler iso_fortran_env iso_fortran_env module~mod_profiler->iso_fortran_env module~mod_kinds mod_kinds module~mod_profiler->module~mod_kinds mpi_f08 mpi_f08 module~mod_profiler->mpi_f08 module~mod_kinds->iso_fortran_env

Gathers locally-updated cell values and broadcasts to the global mesh.

This routine uses MPI_Allgatherv to synchronize the "owned" partition results across all ranks.

Arguments

Type IntentOptional Attributes Name
type(flow_mpi_t), intent(inout) :: flow
real(kind=rk), intent(in) :: local_global(:)
real(kind=rk), intent(out) :: global(:)

Calls

proc~~flow_allgather_owned_scalar~~CallsGraph proc~flow_allgather_owned_scalar mod_mpi_flow::flow_allgather_owned_scalar mpi_allgatherv mpi_allgatherv proc~flow_allgather_owned_scalar->mpi_allgatherv proc~check_mpi~2 mod_mpi_flow::check_mpi proc~flow_allgather_owned_scalar->proc~check_mpi~2 proc~fatal_error mod_kinds::fatal_error proc~flow_allgather_owned_scalar->proc~fatal_error proc~profiler_start mod_profiler::profiler_start proc~flow_allgather_owned_scalar->proc~profiler_start proc~profiler_stop mod_profiler::profiler_stop proc~flow_allgather_owned_scalar->proc~profiler_stop proc~check_mpi~2->proc~fatal_error mpi_wtime mpi_wtime proc~profiler_start->mpi_wtime proc~find_or_create_timer mod_profiler::find_or_create_timer proc~profiler_start->proc~find_or_create_timer proc~profiler_stop->mpi_wtime proc~profiler_stop->proc~find_or_create_timer proc~record_edge mod_profiler::record_edge proc~profiler_stop->proc~record_edge

Source Code

   subroutine flow_allgather_owned_scalar(flow, local_global, global)
      use mod_profiler, only : profiler_start, profiler_stop
      type(flow_mpi_t), intent(inout) :: flow
      real(rk), intent(in) :: local_global(:)
      real(rk), intent(out) :: global(:)
      integer :: ierr, r, first

      if (.not. allocated(flow%gather_sendbuf)) then
         call fatal_error('mpi_flow', 'owned gather buffers are not initialized')
      end if

      flow%gather_sendbuf = local_global(flow%first_cell:flow%last_cell)

      call profiler_start('MPI_Communication')
      call MPI_Allgatherv(flow%gather_sendbuf, flow%nlocal, MPI_DOUBLE_PRECISION, &
                          flow%gather_recvbuf, flow%gather_counts, flow%gather_displs, &
                          MPI_DOUBLE_PRECISION, flow%comm, ierr)
      call check_mpi(ierr, 'MPI_Allgatherv owned scalar')
      call profiler_stop('MPI_Communication')

      global = zero

      do r = 1, flow%nprocs
         first = flow%gather_firsts(r)

         global(first:first + flow%gather_counts(r) - 1) = &
            flow%gather_recvbuf(flow%gather_displs(r) + 1: &
                                flow%gather_displs(r) + flow%gather_counts(r))
      end do
   end subroutine flow_allgather_owned_scalar