flow_global_sum_owned Function

public function flow_global_sum_owned(flow, a) result(total)

Uses

  • proc~~flow_global_sum_owned~~UsesGraph proc~flow_global_sum_owned mod_mpi_flow::flow_global_sum_owned module~mod_profiler mod_profiler proc~flow_global_sum_owned->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

Computes the global sum of a field over owned cells.

Arguments

Type IntentOptional Attributes Name
type(flow_mpi_t), intent(in) :: flow
real(kind=rk), intent(in) :: a(:)

Return Value real(kind=rk)


Calls

proc~~flow_global_sum_owned~~CallsGraph proc~flow_global_sum_owned mod_mpi_flow::flow_global_sum_owned mpi_allreduce mpi_allreduce proc~flow_global_sum_owned->mpi_allreduce proc~check_mpi~2 mod_mpi_flow::check_mpi proc~flow_global_sum_owned->proc~check_mpi~2 proc~profiler_start mod_profiler::profiler_start proc~flow_global_sum_owned->proc~profiler_start proc~profiler_stop mod_profiler::profiler_stop proc~flow_global_sum_owned->proc~profiler_stop proc~fatal_error mod_kinds::fatal_error 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

   function flow_global_sum_owned(flow, a) result(total)
      use mod_profiler, only : profiler_start, profiler_stop
      type(flow_mpi_t), intent(in) :: flow
      real(rk), intent(in) :: a(:)
      real(rk) :: total, local_total
      integer :: c, ierr

      local_total = 0.0_rk
      do c = flow%first_cell, flow%last_cell
         local_total = local_total + a(c)
      end do

      if (flow%nprocs == 1) then
         total = local_total
         return
      end if

      call profiler_start('MPI_Communication')
      call MPI_Allreduce(local_total, total, 1, MPI_DOUBLE_PRECISION, MPI_SUM, flow%comm, ierr)
      call check_mpi(ierr, 'MPI_Allreduce flow sum')
      call profiler_stop('MPI_Communication')
   end function flow_global_sum_owned