engine_enter_data Subroutine

public subroutine engine_enter_data(engine, cfg)

Map the ocean state onto the device, then (when bt_halo > 0) allocate + attach the wide-halo BT march-in workspace, then warm up the device-path halo exchanges (UCX cuda_ipc handle open, outside any timed region — see driver_run_ocean’s “Content-safety argument” comment, carried over unchanged).

Arguments

Type IntentOptional Attributes Name
type(ocean_engine_t), intent(inout) :: engine
type(config_t), intent(in) :: cfg

Calls

proc~~engine_enter_data~~CallsGraph proc~engine_enter_data engine_enter_data interface~ocean_halo_face_x ocean_halo_face_x proc~engine_enter_data->interface~ocean_halo_face_x proc~ocean_dyn_enable_bt_wide ocean_dyn_enable_bt_wide proc~engine_enter_data->proc~ocean_dyn_enable_bt_wide proc~ocean_halo_bt_group_2d ocean_halo_bt_group_2d proc~engine_enter_data->proc~ocean_halo_bt_group_2d proc~ocean_halo_bt_group_2d_wide ocean_halo_bt_group_2d_wide proc~engine_enter_data->proc~ocean_halo_bt_group_2d_wide proc~ocean_halo_exchange_ml_state ocean_halo_exchange_ml_state proc~engine_enter_data->proc~ocean_halo_exchange_ml_state proc~ocean_state_enter_data ocean_state_enter_data proc~engine_enter_data->proc~ocean_state_enter_data 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~bt_wide_enter_data bt_wide_t%bt_wide_enter_data proc~ocean_dyn_enable_bt_wide->proc~bt_wide_enter_data proc~bt_wide_init bt_wide_t%bt_wide_init proc~ocean_dyn_enable_bt_wide->proc~bt_wide_init proc~parse_coriolis_scheme parse_coriolis_scheme proc~ocean_dyn_enable_bt_wide->proc~parse_coriolis_scheme proc~parse_grid_config parse_grid_config proc~ocean_dyn_enable_bt_wide->proc~parse_grid_config to_string to_string proc~ocean_dyn_enable_bt_wide->to_string warning warning proc~ocean_dyn_enable_bt_wide->warning proc~ocean_halo_centre_2d ocean_halo_centre_2d proc~ocean_halo_bt_group_2d->proc~ocean_halo_centre_2d proc~ocean_halo_bt_group_2d->proc~ocean_halo_face_x_2d proc~ocean_halo_face_y_2d ocean_halo_face_y_2d proc~ocean_halo_bt_group_2d->proc~ocean_halo_face_y_2d proc~oh_count_bt_group oh_count_bt_group proc~ocean_halo_bt_group_2d->proc~oh_count_bt_group proc~oh_count_suppress_off oh_count_suppress_off proc~ocean_halo_bt_group_2d->proc~oh_count_suppress_off proc~oh_count_suppress_on oh_count_suppress_on proc~ocean_halo_bt_group_2d->proc~oh_count_suppress_on proc~ocean_halo_buffers_ensure_wide ocean_halo_buffers_ensure_wide proc~ocean_halo_bt_group_2d_wide->proc~ocean_halo_buffers_ensure_wide proc~ocean_halo_centre_2d_impl ocean_halo_centre_2d_impl proc~ocean_halo_bt_group_2d_wide->proc~ocean_halo_centre_2d_impl proc~ocean_halo_face_x_2d_impl ocean_halo_face_x_2d_impl proc~ocean_halo_bt_group_2d_wide->proc~ocean_halo_face_x_2d_impl proc~ocean_halo_face_y_2d_impl ocean_halo_face_y_2d_impl proc~ocean_halo_bt_group_2d_wide->proc~ocean_halo_face_y_2d_impl proc~ocean_halo_bt_group_2d_wide->proc~oh_count_bt_group proc~ocean_halo_bt_group_2d_wide->proc~oh_count_suppress_off proc~ocean_halo_bt_group_2d_wide->proc~oh_count_suppress_on proc~wide_halo_guards wide_halo_guards proc~ocean_halo_bt_group_2d_wide->proc~wide_halo_guards proc~ocean_halo_exchange_ml_state->interface~ocean_halo_face_x interface~ocean_halo_centre ocean_halo_centre proc~ocean_halo_exchange_ml_state->interface~ocean_halo_centre 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~ocean_halo_exchange_ml_state->proc~oh_count_suppress_off 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~barotropic_state_enter_data barotropic_state_t%barotropic_state_enter_data proc~ocean_state_enter_data->proc~barotropic_state_enter_data proc~ocean_bc_state_enter_data ocean_bc_state_enter_data proc~ocean_state_enter_data->proc~ocean_bc_state_enter_data proc~ocean_state_enter_data->proc~profiler_start proc~ocean_state_enter_data->proc~profiler_stop 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 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~barotropic_state_enter_data_impl barotropic_state_enter_data_impl proc~barotropic_state_enter_data->proc~barotropic_state_enter_data_impl proc~bt_wide_enter_data_impl bt_wide_enter_data_impl proc~bt_wide_enter_data->proc~bt_wide_enter_data_impl f_centre_scratch f_centre_scratch proc~bt_wide_init->f_centre_scratch proc~grid_init hgrid_t%grid_init proc~bt_wide_init->proc~grid_init proc~metrics_fill_cartesian metrics_fill_cartesian proc~bt_wide_init->proc~metrics_fill_cartesian proc~metrics_fill_coriolis metrics_fill_coriolis proc~bt_wide_init->proc~metrics_fill_coriolis proc~metrics_fill_spherical metrics_fill_spherical proc~bt_wide_init->proc~metrics_fill_spherical proc~metrics_finalize metrics_finalize proc~bt_wide_init->proc~metrics_finalize proc~ocean_halo_buffers_ensure_wide->to_string proc~ocean_halo_buffers_ensure_wide->warning 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_2d_impl->comm_irecv_real_sp_array_n comm_isend_real_sp_array_n comm_isend_real_sp_array_n proc~ocean_halo_centre_2d_impl->comm_isend_real_sp_array_n proc~comm_env_compute_comm comm_env_compute_comm proc~ocean_halo_centre_2d_impl->proc~comm_env_compute_comm proc~ew_rank_east ew_rank_east proc~ocean_halo_centre_2d_impl->proc~ew_rank_east proc~ew_rank_west ew_rank_west proc~ocean_halo_centre_2d_impl->proc~ew_rank_west proc~needs_flags needs_flags proc~ocean_halo_centre_2d_impl->proc~needs_flags proc~ns_rank_north ns_rank_north proc~ocean_halo_centre_2d_impl->proc~ns_rank_north proc~ns_rank_south ns_rank_south proc~ocean_halo_centre_2d_impl->proc~ns_rank_south proc~ocean_periodic_wrap_centre_2d ocean_periodic_wrap_centre_2d proc~ocean_halo_centre_2d_impl->proc~ocean_periodic_wrap_centre_2d proc~oh_count_msgs oh_count_msgs proc~ocean_halo_centre_2d_impl->proc~oh_count_msgs waitall waitall proc~ocean_halo_centre_2d_impl->waitall 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_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_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_x_2d_impl->proc~oh_count_msgs proc~ocean_halo_face_x_2d_impl->waitall 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_buffers_ensure_nz ocean_halo_buffers_ensure_nz 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->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_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_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 proc~ocean_halo_face_y_2d_impl->proc~oh_count_msgs proc~ocean_halo_face_y_2d_impl->waitall 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~wide_halo_guards->to_string error error proc~wide_halo_guards->error proc~ocean_metrics_enter_data ocean_metrics_t%ocean_metrics_enter_data proc~bt_wide_enter_data_impl->proc~ocean_metrics_enter_data 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~adcroft_recip adcroft_recip proc~metrics_finalize->proc~adcroft_recip proc~ns_rank_north->proc~decomp_rank_from_coords proc~ns_rank_south->proc~decomp_rank_from_coords proc~ocean_halo_buffers_ensure_nz->to_string proc~ocean_halo_buffers_ensure_nz->warning proc~ocean_halo_centre_3d->comm_irecv_real_sp_array_n proc~ocean_halo_centre_3d->comm_isend_real_sp_array_n proc~ocean_halo_centre_3d->proc~comm_env_compute_comm proc~ocean_halo_centre_3d->proc~ew_rank_east proc~ocean_halo_centre_3d->proc~ew_rank_west proc~ocean_halo_centre_3d->proc~needs_flags proc~ocean_halo_centre_3d->proc~ns_rank_north proc~ocean_halo_centre_3d->proc~ns_rank_south proc~ocean_halo_centre_3d->proc~ocean_halo_buffers_ensure_nz proc~ocean_halo_centre_3d->proc~oh_count_msgs proc~ocean_halo_centre_3d->waitall 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~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_halo_face_y_3d->proc~oh_count_msgs proc~ocean_halo_face_y_3d->waitall 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_metrics_enter_data_impl ocean_metrics_enter_data_impl proc~ocean_metrics_enter_data->proc~ocean_metrics_enter_data_impl

Called by

proc~~engine_enter_data~~CalledByGraph proc~engine_enter_data engine_enter_data proc~complete_ocean_create complete_ocean_create proc~complete_ocean_create->proc~engine_enter_data proc~driver_run_ocean driver_run_ocean proc~driver_run_ocean->proc~engine_enter_data 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

Source Code

   subroutine engine_enter_data(engine, cfg)
      !! Map the ocean state onto the device, then (when `bt_halo > 0`)
      !! allocate + attach the wide-halo BT march-in workspace, then
      !! warm up the device-path halo exchanges (UCX cuda_ipc handle
      !! open, outside any timed region — see `driver_run_ocean`'s
      !! "Content-safety argument" comment, carried over unchanged).
      type(ocean_engine_t), intent(inout) :: engine
      type(config_t), intent(in) :: cfg

      call ocean_state_enter_data(engine%state)
      engine%state%dyn%bt_halo = cfg%ocean%bt%bt_halo
      if (cfg%ocean%bt%bt_halo > 0) then
         call ocean_dyn_enable_bt_wide(engine%state%dyn, engine%grid, &
                                       cfg%dx, cfg%dy, &
                                       cfg%ocean%grid%lon_west, &
                                       cfg%ocean%grid%lat_south, &
                                       cfg%ocean%grid%rad_earth, &
                                       cfg%ocean%grid%grid_config, &
                                       cfg%coriolis_f, &
                                       cfg%ocean%topo%coriolis_beta, &
                                       cfg%ocean%topo%coriolis_y_ref, &
                                       cfg%ocean%grid%coriolis_scheme, &
                                       omega=cfg%ocean%grid%omega)
      end if

      ! The prognostic exchange is a WARM-UP (it opens the device-path
      ! handles outside any timed region), but it is not content-neutral:
      ! at a step boundary the duplicated seam faces of `u` hold each
      ! tile's own update and the exchange overwrites them.  On a cold
      ! start that is harmless (the seed is seam-consistent); on a warm
      ! restart it rewrote the checkpointed state before the first step.
      ! Skip it there -- the first step's own exchange opens the handles.
      if (.not. engine%warm_restart) then
         call ocean_halo_exchange_ml_state(engine%state%multilayer)
      end if
      if (cfg%ocean%bt%n_inner >= 1) then
         call ocean_halo_bt_group_2d(engine%state%dyn%bt_work%bt_eta, &
                                     engine%state%dyn%bt_work%bt_ubt, &
                                     engine%state%dyn%bt_work%bt_vbt)
         call ocean_halo_face_x(engine%state%dyn%bt_work%bt_ubt)
         if (cfg%ocean%bt%bt_halo > 0) then
            call ocean_halo_bt_group_2d_wide( &
               engine%state%dyn%bt_wide%w_eta, &
               engine%state%dyn%bt_wide%w_ubt, &
               engine%state%dyn%bt_wide%w_vbt, &
               engine%state%dyn%bt_wide%ng_wide)
         end if
      end if

      engine%device_mapped = .true.
   end subroutine engine_enter_data