halo_allreduce_sum Subroutine

public subroutine halo_allreduce_sum(local_val, global_val)

MPI_Allreduce with MPI_SUM for CG dot products

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: local_val
real(kind=wp), intent(out) :: global_val

Calls

proc~~halo_allreduce_sum~~CallsGraph proc~halo_allreduce_sum halo_allreduce_sum allreduce allreduce proc~halo_allreduce_sum->allreduce proc~comm_env_compute_comm comm_env_compute_comm proc~halo_allreduce_sum->proc~comm_env_compute_comm comm_world comm_world proc~comm_env_compute_comm->comm_world

Called by

proc~~halo_allreduce_sum~~CalledByGraph proc~halo_allreduce_sum halo_allreduce_sum proc~driver_run_ocean driver_run_ocean proc~driver_run_ocean->proc~halo_allreduce_sum proc~ocean_console_stats_report ocean_console_stats_report proc~driver_run_ocean->proc~ocean_console_stats_report proc~engine_setup engine_setup proc~driver_run_ocean->proc~engine_setup proc~engine_step engine_step proc~driver_run_ocean->proc~engine_step proc~ocean_cavity_mass_step ocean_cavity_mass_step proc~ocean_cavity_mass_step->proc~halo_allreduce_sum proc~ocean_console_stats_report->proc~halo_allreduce_sum proc~refuse_open_zfixed_staircase refuse_open_zfixed_staircase proc~refuse_open_zfixed_staircase->proc~halo_allreduce_sum proc~configure_ocean_closed_faces configure_ocean_closed_faces proc~configure_ocean_closed_faces->proc~refuse_open_zfixed_staircase proc~driver_run driver_run proc~driver_run->proc~driver_run_ocean proc~run_stage run_stage proc~run_stage->proc~ocean_cavity_mass_step proc~run_stage_split run_stage_split proc~run_stage_split->proc~ocean_cavity_mass_step proc~engine_setup->proc~configure_ocean_closed_faces proc~ocean_dyn_step ocean_dyn_step proc~ocean_dyn_step->proc~run_stage proc~ocean_dyn_step_split ocean_dyn_step_split proc~ocean_dyn_step_split->proc~run_stage_split proc~complete_ocean_create complete_ocean_create proc~complete_ocean_create->proc~engine_setup proc~driver_validate driver_validate proc~driver_validate->proc~engine_setup proc~engine_step->proc~ocean_dyn_step proc~engine_step->proc~ocean_dyn_step_split proc~rdb_ocean_create_finalize rdb_ocean_create_finalize proc~rdb_ocean_create_finalize->proc~complete_ocean_create proc~rdb_ocean_create_from_string rdb_ocean_create_from_string proc~rdb_ocean_create_from_string->proc~complete_ocean_create proc~rdb_ocean_step rdb_ocean_step proc~rdb_ocean_step->proc~engine_step

Variables

Type Visibility Attributes Name Initial
type(comm_t), private :: comm

Source Code

   subroutine halo_allreduce_sum(local_val, global_val)
      !! MPI_Allreduce with MPI_SUM for CG dot products
      real(wp), intent(in) :: local_val
      real(wp), intent(out) :: global_val

      type(comm_t) :: comm

      comm = comm_env_compute_comm()
      ! Single rank: the reduction is the identity, so return this rank's
      ! own contribution without entering a collective.  Not just an
      ! optimisation -- pic-mpi's serial backend (PIC_ENABLE_MPI=OFF)
      ! deliberately `error stop`s in `allreduce`, pushing the size()==1
      ! case onto the caller.  This IS that case.
      if (comm%size() == 1) then
         global_val = local_val
         return
      end if
      call allreduce(comm, local_val, global_val, op=MPI_SUM)

   end subroutine halo_allreduce_sum