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 | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(ocean_engine_t), | intent(inout) | :: | engine | |||
| type(config_t), | intent(in) | :: | cfg |
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