halo_allreduce_min Subroutine

public subroutine halo_allreduce_min(local_val, global_val)

MPI_Allreduce with MPI_MIN for global timestep

Arguments

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

Calls

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

Called by

proc~~halo_allreduce_min~~CalledByGraph proc~halo_allreduce_min halo_allreduce_min proc~configure_ocean_bt_split configure_ocean_bt_split proc~configure_ocean_bt_split->proc~halo_allreduce_min proc~ok_all_ranks ok_all_ranks proc~ok_all_ranks->proc~halo_allreduce_min proc~engine_setup engine_setup proc~engine_setup->proc~configure_ocean_bt_split proc~ice_transport_step ice_transport_step proc~ice_transport_step->proc~ok_all_ranks proc~complete_ocean_create complete_ocean_create proc~complete_ocean_create->proc~engine_setup proc~driver_run_ocean driver_run_ocean proc~driver_run_ocean->proc~engine_setup proc~engine_step_ice engine_step_ice proc~driver_run_ocean->proc~engine_step_ice proc~driver_validate driver_validate proc~driver_validate->proc~engine_setup proc~engine_step_ice->proc~ice_transport_step proc~driver_run driver_run proc~driver_run->proc~driver_run_ocean 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_ice

Variables

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

Source Code

   subroutine halo_allreduce_min(local_val, global_val)
      !! MPI_Allreduce with MPI_MIN for global timestep
      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_MIN)

   end subroutine halo_allreduce_min