ocean_halo_exchange_ml_state Subroutine

public subroutine ocean_halo_exchange_ml_state(ms, device_resident)

Exchange ghost cells for the four multilayer prognostic field kinds via the O1 halo primitives:

  • h_layer — cell-centred layer thickness (centre_3d)
  • u_face_x_layer — east-face layer velocity (face_x_3d)
  • v_face_y_layer — north-face layer velocity (face_y_3d)
  • tracers(it)%hTr — per-tracer thickness-weighted scalar (centre_3d, outer-shim loop)

Unconditional (D0): single-rank + non-periodic ⇒ no-op; single-rank + periodic ⇒ local wrap; multi-rank ⇒ messages. Corner ghosts valid on return (D2 two-pass inside the primitives).

Arguments

Type IntentOptional Attributes Name
type(multilayer_state_t), intent(inout) :: ms

Multilayer C-grid state whose ghost bands are to be filled.

logical, intent(in), optional :: device_resident

Forwarded to every primitive call. Pass .false. for init-time host-side exchanges that occur before ocean_state_enter_data. Default (.true.) is the normal device-resident path.


Calls

proc~~ocean_halo_exchange_ml_state~~CallsGraph proc~ocean_halo_exchange_ml_state ocean_halo_exchange_ml_state interface~ocean_halo_centre ocean_halo_centre proc~ocean_halo_exchange_ml_state->interface~ocean_halo_centre interface~ocean_halo_face_x ocean_halo_face_x proc~ocean_halo_exchange_ml_state->interface~ocean_halo_face_x interface~ocean_halo_face_y ocean_halo_face_y proc~ocean_halo_exchange_ml_state->interface~ocean_halo_face_y proc~oh_count_ml_state oh_count_ml_state proc~ocean_halo_exchange_ml_state->proc~oh_count_ml_state proc~oh_count_suppress_off oh_count_suppress_off proc~ocean_halo_exchange_ml_state->proc~oh_count_suppress_off proc~oh_count_suppress_on oh_count_suppress_on proc~ocean_halo_exchange_ml_state->proc~oh_count_suppress_on proc~profiler_start profiler_start proc~ocean_halo_exchange_ml_state->proc~profiler_start proc~profiler_stop profiler_stop proc~ocean_halo_exchange_ml_state->proc~profiler_stop proc~ocean_halo_centre_2d ocean_halo_centre_2d interface~ocean_halo_centre->proc~ocean_halo_centre_2d proc~ocean_halo_centre_3d ocean_halo_centre_3d interface~ocean_halo_centre->proc~ocean_halo_centre_3d proc~ocean_halo_face_x_2d ocean_halo_face_x_2d interface~ocean_halo_face_x->proc~ocean_halo_face_x_2d proc~ocean_halo_face_x_3d ocean_halo_face_x_3d interface~ocean_halo_face_x->proc~ocean_halo_face_x_3d proc~ocean_halo_face_y_2d ocean_halo_face_y_2d interface~ocean_halo_face_y->proc~ocean_halo_face_y_2d proc~ocean_halo_face_y_3d ocean_halo_face_y_3d interface~ocean_halo_face_y->proc~ocean_halo_face_y_3d proc~find_or_create_region find_or_create_region proc~profiler_start->proc~find_or_create_region proc~get_wall_time get_wall_time proc~profiler_start->proc~get_wall_time proc~nvtx_range_push nvtx_range_push proc~profiler_start->proc~nvtx_range_push proc~profiler_stop->proc~get_wall_time proc~nvtx_range_pop nvtx_range_pop proc~profiler_stop->proc~nvtx_range_pop proc~ocean_halo_centre_2d_impl ocean_halo_centre_2d_impl proc~ocean_halo_centre_2d->proc~ocean_halo_centre_2d_impl proc~oh_count_centre_2d oh_count_centre_2d proc~ocean_halo_centre_2d->proc~oh_count_centre_2d comm_irecv_real_sp_array_n comm_irecv_real_sp_array_n proc~ocean_halo_centre_3d->comm_irecv_real_sp_array_n comm_isend_real_sp_array_n comm_isend_real_sp_array_n proc~ocean_halo_centre_3d->comm_isend_real_sp_array_n proc~comm_env_compute_comm comm_env_compute_comm proc~ocean_halo_centre_3d->proc~comm_env_compute_comm proc~ew_rank_east ew_rank_east proc~ocean_halo_centre_3d->proc~ew_rank_east proc~ew_rank_west ew_rank_west proc~ocean_halo_centre_3d->proc~ew_rank_west proc~needs_flags needs_flags proc~ocean_halo_centre_3d->proc~needs_flags proc~ns_rank_north ns_rank_north proc~ocean_halo_centre_3d->proc~ns_rank_north proc~ns_rank_south ns_rank_south proc~ocean_halo_centre_3d->proc~ns_rank_south proc~ocean_halo_buffers_ensure_nz ocean_halo_buffers_ensure_nz proc~ocean_halo_centre_3d->proc~ocean_halo_buffers_ensure_nz proc~ocean_periodic_wrap_centre_3d ocean_periodic_wrap_centre_3d proc~ocean_halo_centre_3d->proc~ocean_periodic_wrap_centre_3d proc~oh_count_centre_3d oh_count_centre_3d proc~ocean_halo_centre_3d->proc~oh_count_centre_3d proc~oh_count_msgs oh_count_msgs proc~ocean_halo_centre_3d->proc~oh_count_msgs waitall waitall proc~ocean_halo_centre_3d->waitall proc~ocean_halo_face_x_2d_impl ocean_halo_face_x_2d_impl proc~ocean_halo_face_x_2d->proc~ocean_halo_face_x_2d_impl proc~oh_count_face_x_2d oh_count_face_x_2d proc~ocean_halo_face_x_2d->proc~oh_count_face_x_2d proc~ocean_halo_face_x_3d->comm_irecv_real_sp_array_n proc~ocean_halo_face_x_3d->comm_isend_real_sp_array_n proc~ocean_halo_face_x_3d->proc~comm_env_compute_comm proc~ocean_halo_face_x_3d->proc~ew_rank_east proc~ocean_halo_face_x_3d->proc~ew_rank_west proc~ocean_halo_face_x_3d->proc~needs_flags proc~ocean_halo_face_x_3d->proc~ns_rank_north proc~ocean_halo_face_x_3d->proc~ns_rank_south proc~ocean_halo_face_x_3d->proc~ocean_halo_buffers_ensure_nz proc~ocean_periodic_wrap_face_x_3d ocean_periodic_wrap_face_x_3d proc~ocean_halo_face_x_3d->proc~ocean_periodic_wrap_face_x_3d proc~oh_count_face_x_3d oh_count_face_x_3d proc~ocean_halo_face_x_3d->proc~oh_count_face_x_3d proc~ocean_halo_face_x_3d->proc~oh_count_msgs proc~ocean_halo_face_x_3d->waitall proc~ocean_halo_face_y_2d_impl ocean_halo_face_y_2d_impl proc~ocean_halo_face_y_2d->proc~ocean_halo_face_y_2d_impl proc~oh_count_face_y_2d oh_count_face_y_2d proc~ocean_halo_face_y_2d->proc~oh_count_face_y_2d proc~ocean_halo_face_y_3d->comm_irecv_real_sp_array_n proc~ocean_halo_face_y_3d->comm_isend_real_sp_array_n proc~ocean_halo_face_y_3d->proc~comm_env_compute_comm proc~ocean_halo_face_y_3d->proc~ew_rank_east proc~ocean_halo_face_y_3d->proc~ew_rank_west proc~ocean_halo_face_y_3d->proc~needs_flags proc~ocean_halo_face_y_3d->proc~ns_rank_north proc~ocean_halo_face_y_3d->proc~ns_rank_south proc~ocean_halo_face_y_3d->proc~ocean_halo_buffers_ensure_nz proc~ocean_periodic_wrap_face_y_3d ocean_periodic_wrap_face_y_3d proc~ocean_halo_face_y_3d->proc~ocean_periodic_wrap_face_y_3d proc~oh_count_face_y_3d oh_count_face_y_3d proc~ocean_halo_face_y_3d->proc~oh_count_face_y_3d proc~ocean_halo_face_y_3d->proc~oh_count_msgs proc~ocean_halo_face_y_3d->waitall comm_world comm_world proc~comm_env_compute_comm->comm_world proc~decomp_rank_from_coords decomp_rank_from_coords proc~ew_rank_east->proc~decomp_rank_from_coords proc~ew_rank_west->proc~decomp_rank_from_coords proc~ns_rank_north->proc~decomp_rank_from_coords proc~ns_rank_south->proc~decomp_rank_from_coords to_string to_string proc~ocean_halo_buffers_ensure_nz->to_string warning warning proc~ocean_halo_buffers_ensure_nz->warning proc~ocean_halo_centre_2d_impl->comm_irecv_real_sp_array_n proc~ocean_halo_centre_2d_impl->comm_isend_real_sp_array_n proc~ocean_halo_centre_2d_impl->proc~comm_env_compute_comm proc~ocean_halo_centre_2d_impl->proc~ew_rank_east proc~ocean_halo_centre_2d_impl->proc~ew_rank_west proc~ocean_halo_centre_2d_impl->proc~needs_flags proc~ocean_halo_centre_2d_impl->proc~ns_rank_north proc~ocean_halo_centre_2d_impl->proc~ns_rank_south proc~ocean_halo_centre_2d_impl->proc~oh_count_msgs proc~ocean_halo_centre_2d_impl->waitall proc~ocean_periodic_wrap_centre_2d ocean_periodic_wrap_centre_2d proc~ocean_halo_centre_2d_impl->proc~ocean_periodic_wrap_centre_2d proc~ocean_halo_face_x_2d_impl->comm_irecv_real_sp_array_n proc~ocean_halo_face_x_2d_impl->comm_isend_real_sp_array_n proc~ocean_halo_face_x_2d_impl->proc~comm_env_compute_comm proc~ocean_halo_face_x_2d_impl->proc~ew_rank_east proc~ocean_halo_face_x_2d_impl->proc~ew_rank_west proc~ocean_halo_face_x_2d_impl->proc~needs_flags proc~ocean_halo_face_x_2d_impl->proc~ns_rank_north proc~ocean_halo_face_x_2d_impl->proc~ns_rank_south proc~ocean_halo_face_x_2d_impl->proc~oh_count_msgs proc~ocean_halo_face_x_2d_impl->waitall proc~ocean_periodic_wrap_face_x_2d ocean_periodic_wrap_face_x_2d proc~ocean_halo_face_x_2d_impl->proc~ocean_periodic_wrap_face_x_2d proc~ocean_halo_face_y_2d_impl->comm_irecv_real_sp_array_n proc~ocean_halo_face_y_2d_impl->comm_isend_real_sp_array_n proc~ocean_halo_face_y_2d_impl->proc~comm_env_compute_comm proc~ocean_halo_face_y_2d_impl->proc~ew_rank_east proc~ocean_halo_face_y_2d_impl->proc~ew_rank_west proc~ocean_halo_face_y_2d_impl->proc~needs_flags proc~ocean_halo_face_y_2d_impl->proc~ns_rank_north proc~ocean_halo_face_y_2d_impl->proc~ns_rank_south proc~ocean_halo_face_y_2d_impl->proc~oh_count_msgs proc~ocean_halo_face_y_2d_impl->waitall proc~ocean_periodic_wrap_face_y_2d ocean_periodic_wrap_face_y_2d proc~ocean_halo_face_y_2d_impl->proc~ocean_periodic_wrap_face_y_2d

Called by

proc~~ocean_halo_exchange_ml_state~~CalledByGraph proc~ocean_halo_exchange_ml_state ocean_halo_exchange_ml_state proc~engine_enter_data engine_enter_data proc~engine_enter_data->proc~ocean_halo_exchange_ml_state proc~engine_setup engine_setup proc~engine_setup->proc~ocean_halo_exchange_ml_state proc~run_continuity_chain run_continuity_chain proc~run_continuity_chain->proc~ocean_halo_exchange_ml_state proc~run_gm_step run_gm_step proc~run_gm_step->proc~ocean_halo_exchange_ml_state proc~run_stage_split run_stage_split proc~run_stage_split->proc~ocean_halo_exchange_ml_state proc~run_stage_split->proc~run_continuity_chain proc~complete_ocean_create complete_ocean_create proc~complete_ocean_create->proc~engine_enter_data proc~complete_ocean_create->proc~engine_setup proc~driver_run_ocean driver_run_ocean proc~driver_run_ocean->proc~engine_enter_data proc~driver_run_ocean->proc~engine_setup proc~engine_step engine_step proc~driver_run_ocean->proc~engine_step proc~driver_validate driver_validate proc~driver_validate->proc~engine_setup proc~ocean_dyn_step_split ocean_dyn_step_split proc~ocean_dyn_step_split->proc~run_gm_step proc~ocean_dyn_step_split->proc~run_stage_split proc~driver_run driver_run proc~driver_run->proc~driver_run_ocean 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
integer, private :: it

Source Code

   subroutine ocean_halo_exchange_ml_state(ms, device_resident)
      !! Exchange ghost cells for the four multilayer prognostic field kinds
      !! via the O1 halo primitives:
      !!
      !!   * `h_layer`          — cell-centred layer thickness (centre_3d)
      !!   * `u_face_x_layer`   — east-face layer velocity (face_x_3d)
      !!   * `v_face_y_layer`   — north-face layer velocity (face_y_3d)
      !!   * `tracers(it)%hTr`  — per-tracer thickness-weighted scalar
      !!                          (centre_3d, outer-shim loop)
      !!
      !! Unconditional (D0): single-rank + non-periodic ⇒ no-op;
      !! single-rank + periodic ⇒ local wrap; multi-rank ⇒ messages.
      !! Corner ghosts valid on return (D2 two-pass inside the primitives).
      type(multilayer_state_t), intent(inout) :: ms
         !! Multilayer C-grid state whose ghost bands are to be filled.
      logical, intent(in), optional :: device_resident
         !! Forwarded to every primitive call.  Pass .false. for init-time
         !! host-side exchanges that occur before ocean_state_enter_data.
         !! Default (.true.) is the normal device-resident path.

      integer :: it

      call profiler_start("ocean_comms_ml")
      call oh_count_ml_state()
      call oh_count_suppress_on()
      call ocean_halo_centre(ms%h_layer, ms%nz_ml, device_resident)
      call ocean_halo_face_x(ms%u_face_x_layer, ms%nz_ml, device_resident)
      call ocean_halo_face_y(ms%v_face_y_layer, ms%nz_ml, device_resident)

      ! Per-tracer loop outside DC — outer-shim pattern: array-of-DT
      ! cannot be dereferenced inside a do concurrent on-device.
      if (allocated(ms%tracers)) then
         do it = 1, size(ms%tracers)
            if (.not. allocated(ms%tracers(it)%hTr)) cycle
            call ocean_halo_centre(ms%tracers(it)%hTr, ms%nz_ml, device_resident)
         end do
      end if
      call oh_count_suppress_off()
      call profiler_stop("ocean_comms_ml")

   end subroutine ocean_halo_exchange_ml_state