ok_all_ranks Subroutine

private subroutine ok_all_ranks(ok)

Make a validity flag rank-uniform (global AND, as an exact min of 0/1) BEFORE anyone acts on it: a rank-local early return would strand the other ranks in the next substep’s exchange. No collective unless the run is decomposed (a serial run inside a multi-rank job — the bit-identity reference — stays local).

Arguments

Type IntentOptional Attributes Name
logical, intent(inout) :: ok

Calls

proc~~ok_all_ranks~~CallsGraph proc~ok_all_ranks ok_all_ranks proc~halo_allreduce_min halo_allreduce_min proc~ok_all_ranks->proc~halo_allreduce_min proc~ocean_halo_is_decomposed ocean_halo_is_decomposed proc~ok_all_ranks->proc~ocean_halo_is_decomposed 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~~ok_all_ranks~~CalledByGraph proc~ok_all_ranks ok_all_ranks proc~ice_transport_step ice_transport_step proc~ice_transport_step->proc~ok_all_ranks proc~engine_step_ice engine_step_ice proc~engine_step_ice->proc~ice_transport_step proc~driver_run_ocean driver_run_ocean proc~driver_run_ocean->proc~engine_step_ice proc~rdb_ocean_step rdb_ocean_step proc~rdb_ocean_step->proc~engine_step_ice proc~driver_run driver_run proc~driver_run->proc~driver_run_ocean

Variables

Type Visibility Attributes Name Initial
real(kind=wp), private :: glob
real(kind=wp), private :: loc

Source Code

   subroutine ok_all_ranks(ok)
      !! Make a validity flag rank-uniform (global AND, as an exact min of
      !! 0/1) BEFORE anyone acts on it: a rank-local early return would
      !! strand the other ranks in the next substep's exchange.  No
      !! collective unless the run is decomposed (a serial run inside a
      !! multi-rank job — the bit-identity reference — stays local).
      logical, intent(inout) :: ok
      real(wp) :: loc, glob

      if (.not. ocean_halo_is_decomposed()) return
      loc = merge(1.0_wp, 0.0_wp, ok)
      call halo_allreduce_min(loc, glob)
      ok = glob > 0.5_wp
   end subroutine ok_all_ranks