Attach the slot’s allocatables to the device. copyin (not
create) throughout: every array is host-initialised (0, or
part_size/sal_ice’s non-zero defaults) at init, and a
restart read seeds the persistent ones host-side before the
mapping. PR 3c’s seam + scratch fields are also copyin: they
are host-zeroed at init and (re)filled device-side every thermo
step, so a plain copyin is correct (and cheap — one-time).
PR 4b: u_ice/v_ice are copyin (host-zeroed at init, and the
v1 sampler / PR-5 EVP both WRITE them device-side every call —
copyin establishes presence, same contract as the atm_* seam).
PR 5: str_d/str_t/str_s are copyin (host-zeroed at init or
restart-seeded; ice_evp_dynamics reads them before the first
write on every call — limit_stresses runs first). tau_a_x/
tau_a_y are copyin (host-snapshotted at configure, then read
device-side every substep — never written on-device). fxoc/
fyoc are copyin (host-zeroed at init or restart-seeded; the
EVP core zeros them itself at call entry before accumulating).
PR 63: tau_ocn_x/tau_ocn_y are copyin (host-zeroed at init
or restart-seeded; ice_tau_mirror_impl WRITES them device-side
every call to ice_ocean_stress_flux — same reasoning as
fxoc/fyoc). tau_ocn_valid is NEVER mapped — it is host-only
scalar state, set on the host by ice_ocean_stress_flux and read
on the host by ice_ocean_stress_resume_apply; register_scalar
forces device_mapped=.false. on the restart side for the same
reason.
The transport workspace is create (pure scratch, recomputed
from scratch every pass — never read before written), mapped
only if (this%transport) (memory Rule 2, same gate as the
host-side allocation).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(ocean_sea_ice_t), | intent(inout) | :: | this |
subroutine ocean_sea_ice_enter_data_impl(this) !! Attach the slot's allocatables to the device. `copyin` (not !! `create`) throughout: every array is host-initialised (0, or !! `part_size`/`sal_ice`'s non-zero defaults) at init, and a !! restart read seeds the persistent ones host-side before the !! mapping. PR 3c's seam + scratch fields are also `copyin`: they !! are host-zeroed at init and (re)filled device-side every thermo !! step, so a plain `copyin` is correct (and cheap — one-time). !! PR 4b: `u_ice`/`v_ice` are `copyin` (host-zeroed at init, and the !! v1 sampler / PR-5 EVP both WRITE them device-side every call — !! `copyin` establishes presence, same contract as the `atm_*` seam). !! PR 5: `str_d`/`str_t`/`str_s` are `copyin` (host-zeroed at init or !! restart-seeded; `ice_evp_dynamics` reads them before the first !! write on every call — `limit_stresses` runs first). `tau_a_x`/ !! `tau_a_y` are `copyin` (host-snapshotted at configure, then read !! device-side every substep — never written on-device). `fxoc`/ !! `fyoc` are `copyin` (host-zeroed at init or restart-seeded; the !! EVP core zeros them itself at call entry before accumulating). !! PR 63: `tau_ocn_x`/`tau_ocn_y` are `copyin` (host-zeroed at init !! or restart-seeded; `ice_tau_mirror_impl` WRITES them device-side !! every call to `ice_ocean_stress_flux` — same reasoning as !! `fxoc`/`fyoc`). `tau_ocn_valid` is NEVER mapped — it is host-only !! scalar state, set on the host by `ice_ocean_stress_flux` and read !! on the host by `ice_ocean_stress_resume_apply`; `register_scalar` !! forces `device_mapped=.false.` on the restart side for the same !! reason. !! The transport workspace is `create` (pure scratch, recomputed !! from scratch every pass — never read before written), mapped !! only `if (this%transport)` (memory Rule 2, same gate as the !! host-side allocation). type(ocean_sea_ice_t), intent(inout) :: this if (.not. this%is_init) return !$acc enter data copyin(this%frazil_heat, this%heat_budget_frazil) !$acc enter data copyin(this%part_size, this%m_ice, this%m_snow) !$acc enter data copyin(this%enth_ice, this%enth_snow, this%sal_ice) !$acc enter data copyin(this%m_frozen_diag, this%salt_flux_diag) !$acc enter data copyin(this%atm_sf0, this%atm_dsfdt, this%atm_sw_dn, this%atm_fprec) !$acc enter data copyin(this%fb, this%sst_seam, this%ssurf_seam, this%tfw_seam) !$acc enter data copyin(this%tsurf_out, this%h2o_ocn_to_ice, this%h2o_ice_to_ocn) !$acc enter data copyin(this%heat_to_ocn, this%sw_thru, this%snow_to_ice) !$acc enter data copyin(this%heat_flux_diag, this%sw_thru_diag, this%m_melt_diag, & !$acc& this%fprec_ocn_diag) !$acc enter data copyin(this%h_lim, this%mh_lim, this%fb_part_sum, this%snow_part_ocn) !$acc enter data copyin(this%u_ice, this%v_ice) !$acc enter data copyin(this%str_d, this%str_t, this%str_s) !$acc enter data copyin(this%tau_a_x, this%tau_a_y) !$acc enter data copyin(this%fxoc, this%fyoc) !$acc enter data copyin(this%tau_ocn_x, this%tau_ocn_y) ! tau_ocn_valid: NEVER mapped (host-only, register_scalar contract). if (this%dynamics) call this%evp_ws%enter_data() if (this%transport) then !$acc enter data create(this%mca_ice, this%mca_snow) !$acc enter data create(this%uh_ice, this%vh_ice, this%uh_snow, this%vh_snow) !$acc enter data create(this%htot_work, this%hl_x_work, this%hr_x_work) !$acc enter data create(this%hl_y_work, this%hr_y_work) !$acc enter data create(this%uhtot_work, this%vhtot_work) !$acc enter data create(this%tr_flux_x_work, this%tr_flux_y_work) end if end subroutine ocean_sea_ice_enter_data_impl