rdb_ocean_fold_exchange Module

Owner-routed north-fold exchange for an east-west split north rank row, plus the px-dispatching single-field fold entry points (ocean_fold_north_*): px = 1 keeps the local kernels of rdb_ocean_fold verbatim, px > 1 always uses the exchange (the self-mirror tile through a local copy).


Uses

  • module~~rdb_ocean_fold_exchange~~UsesGraph module~rdb_ocean_fold_exchange rdb_ocean_fold_exchange module~rdb_comm_env rdb_comm_env module~rdb_ocean_fold_exchange->module~rdb_comm_env module~rdb_constants rdb_constants module~rdb_ocean_fold_exchange->module~rdb_constants module~rdb_decomp rdb_decomp module~rdb_ocean_fold_exchange->module~rdb_decomp module~rdb_error_ring rdb_error_ring module~rdb_ocean_fold_exchange->module~rdb_error_ring module~rdb_ocean_fold rdb_ocean_fold module~rdb_ocean_fold_exchange->module~rdb_ocean_fold module~rdb_ocean_fold_plan rdb_ocean_fold_plan module~rdb_ocean_fold_exchange->module~rdb_ocean_fold_plan module~rdb_ocean_status rdb_ocean_status module~rdb_ocean_fold_exchange->module~rdb_ocean_status pic_logger pic_logger module~rdb_ocean_fold_exchange->pic_logger pic_mpi_lib pic_mpi_lib module~rdb_ocean_fold_exchange->pic_mpi_lib pic_strings pic_strings module~rdb_ocean_fold_exchange->pic_strings module~rdb_comm_env->module~rdb_constants module~rdb_comm_env->pic_mpi_lib iso_fortran_env iso_fortran_env module~rdb_comm_env->iso_fortran_env pic_types pic_types module~rdb_constants->pic_types module~rdb_config rdb_config module~rdb_decomp->module~rdb_config module~rdb_error_ring->pic_logger module~rdb_ocean_fold->module~rdb_constants module~rdb_config->module~rdb_constants module~rdb_config->module~rdb_error_ring module~rdb_config->module~rdb_ocean_status module~rdb_config->pic_logger module~rdb_config->pic_strings module~rdb_ice_enthalpy rdb_ice_enthalpy module~rdb_config->module~rdb_ice_enthalpy module~rdb_ice_init rdb_ice_init module~rdb_config->module~rdb_ice_init module~rdb_nml_schema rdb_nml_schema module~rdb_config->module~rdb_nml_schema pic_ascii pic_ascii module~rdb_config->pic_ascii module~rdb_ice_enthalpy->module~rdb_constants module~rdb_ice_init->module~rdb_constants module~rdb_ice_init->module~rdb_ice_enthalpy module~rdb_grid rdb_grid module~rdb_ice_init->module~rdb_grid module~rdb_ice_column rdb_ice_column module~rdb_ice_init->module~rdb_ice_column module~rdb_ice_state rdb_ice_state module~rdb_ice_init->module~rdb_ice_state module~rdb_multilayer_state rdb_multilayer_state module~rdb_ice_init->module~rdb_multilayer_state module~rdb_ocean_metrics rdb_ocean_metrics module~rdb_ice_init->module~rdb_ocean_metrics module~rdb_nml_schema->module~rdb_constants module~rdb_nml_schema->module~rdb_error_ring module~rdb_nml_schema->pic_logger module~rdb_grid->module~rdb_constants module~rdb_ice_column->module~rdb_constants module~rdb_ice_column->module~rdb_ice_enthalpy module~rdb_ice_mass rdb_ice_mass module~rdb_ice_column->module~rdb_ice_mass module~rdb_ice_optics rdb_ice_optics module~rdb_ice_column->module~rdb_ice_optics module~rdb_ice_state->module~rdb_constants module~rdb_ice_state->iso_fortran_env module~rdb_ice_state->module~rdb_ice_enthalpy module~rdb_ice_state->module~rdb_grid module~rdb_ice_state->module~rdb_ice_column module~rdb_mem_report rdb_mem_report module~rdb_ice_state->module~rdb_mem_report module~rdb_multilayer_state->module~rdb_constants module~rdb_multilayer_state->module~rdb_error_ring module~rdb_multilayer_state->pic_logger module~rdb_multilayer_state->iso_fortran_env module~rdb_multilayer_state->module~rdb_grid module~rdb_efp rdb_efp module~rdb_multilayer_state->module~rdb_efp module~rdb_multilayer_state->module~rdb_mem_report module~rdb_tracer rdb_tracer module~rdb_multilayer_state->module~rdb_tracer module~rdb_ocean_metrics->module~rdb_constants module~rdb_ocean_metrics->module~rdb_error_ring module~rdb_ocean_metrics->module~rdb_ocean_fold module~rdb_ocean_metrics->module~rdb_ocean_status module~rdb_ocean_metrics->pic_logger module~rdb_ocean_metrics->pic_strings module~rdb_ocean_metrics->iso_fortran_env module~rdb_ocean_metrics->module~rdb_grid module~rdb_io_netcdf rdb_io_netcdf module~rdb_ocean_metrics->module~rdb_io_netcdf module~rdb_ocean_metrics->module~rdb_mem_report module~rdb_ocean_bipolar rdb_ocean_bipolar module~rdb_ocean_metrics->module~rdb_ocean_bipolar netcdf netcdf module~rdb_ocean_metrics->netcdf

Used by

  • module~~rdb_ocean_fold_exchange~~UsedByGraph module~rdb_ocean_fold_exchange rdb_ocean_fold_exchange module~rdb_barotropic_substep rdb_barotropic_substep module~rdb_barotropic_substep->module~rdb_ocean_fold_exchange module~rdb_continuity rdb_continuity module~rdb_continuity->module~rdb_ocean_fold_exchange module~rdb_ocean_fold_apply rdb_ocean_fold_apply module~rdb_continuity->module~rdb_ocean_fold_apply module~rdb_ocean_engine rdb_ocean_engine module~rdb_ocean_engine->module~rdb_ocean_fold_exchange module~rdb_ocean_engine->module~rdb_ocean_fold_apply module~rdb_ocean_setup rdb_ocean_setup module~rdb_ocean_engine->module~rdb_ocean_setup module~rdb_ice_transport rdb_ice_transport module~rdb_ocean_engine->module~rdb_ice_transport module~rdb_ocean_dyn rdb_ocean_dyn module~rdb_ocean_engine->module~rdb_ocean_dyn module~rdb_ocean_halo_state rdb_ocean_halo_state module~rdb_ocean_engine->module~rdb_ocean_halo_state module~rdb_ocean_state rdb_ocean_state module~rdb_ocean_engine->module~rdb_ocean_state module~rdb_ice_ocean_coupler rdb_ice_ocean_coupler module~rdb_ocean_engine->module~rdb_ice_ocean_coupler module~rdb_ocean_data_forcing rdb_ocean_data_forcing module~rdb_ocean_engine->module~rdb_ocean_data_forcing module~rdb_ocean_diag_derived rdb_ocean_diag_derived module~rdb_ocean_engine->module~rdb_ocean_diag_derived module~rdb_ocean_diag_fills rdb_ocean_diag_fills module~rdb_ocean_engine->module~rdb_ocean_diag_fills module~rdb_ocean_fold_apply->module~rdb_ocean_fold_exchange module~rdb_ocean_setup->module~rdb_ocean_fold_exchange module~rdb_ocean_setup->module~rdb_ocean_fold_apply module~rdb_ocean_setup->module~rdb_ocean_dyn module~rdb_ocean_setup->module~rdb_ocean_halo_state module~rdb_ocean_setup->module~rdb_ocean_state module~rdb_driver rdb_driver module~rdb_driver->module~rdb_ocean_engine module~rdb_driver->module~rdb_ocean_dyn module~rdb_driver->module~rdb_ocean_state module~rdb_handle rdb_handle module~rdb_handle->module~rdb_ocean_engine module~rdb_handle->module~rdb_ocean_state module~rdb_ice_transport->module~rdb_continuity module~rdb_ice_transport->module~rdb_ocean_halo_state module~rdb_ocean_api rdb_ocean_api module~rdb_ocean_api->module~rdb_ocean_engine module~rdb_ocean_api->module~rdb_ocean_fold_apply module~rdb_ocean_api->module~rdb_handle module~rdb_ocean_api->module~rdb_ocean_dyn module~rdb_ocean_api->module~rdb_ocean_diag_derived module~rdb_ocean_api->module~rdb_ocean_diag_fills module~rdb_ocean_bt_wide rdb_ocean_bt_wide module~rdb_ocean_bt_wide->module~rdb_barotropic_substep module~rdb_ocean_dyn->module~rdb_barotropic_substep module~rdb_ocean_dyn->module~rdb_continuity module~rdb_ocean_dyn->module~rdb_ocean_fold_apply module~rdb_ocean_dyn->module~rdb_ocean_bt_wide module~rdb_ocean_dyn->module~rdb_ocean_halo_state module~rdb_ocean_halo_state->module~rdb_ocean_fold_apply module~rdb_ocean_state->module~rdb_continuity module~rdb_ocean_state->module~rdb_ocean_dyn module~rdb_ocean_state->module~rdb_ocean_data_forcing module~rdb_ice_ocean_coupler->module~rdb_ocean_halo_state module~rdb_ocean_data_forcing->module~rdb_ocean_halo_state module~rdb_ocean_diag_derived->module~rdb_ocean_state module~rdb_ocean_diag_derived->module~rdb_ocean_diag_fills module~rdb_ocean_diag_fills->module~rdb_ocean_state

Variables

Type Visibility Attributes Name Initial
integer, private, parameter :: TAG_OC_FOLD = 15

Fold message tag (halo: 11-14, rdb_halo: 1-4).

logical, private :: fx_active = .false.

This rank takes part in a distributed fold (px > 1, folded north edge, north rank row).

integer, private :: fx_cap = 0

Per-peer capacity (values).

logical, private :: fx_initialised = .false.

True after ocean_fold_exchange_init.

integer, private :: fx_ng = 0

Ghost width.

integer, private :: fx_nmax = 1

Largest (peer, family) entry count.

integer, private :: fx_npeer = 0

Peers (self included when it routes to itself).

integer, private :: fx_nr(FOLD_NFAM) = 0

Receive entries per family.

integer, private :: fx_ns(FOLD_NFAM) = 0

Send entries per family.

integer, private :: fx_nxl = 0

Tile physical width.

integer, private :: fx_nyl = 0

Tile physical height (identical on every north-row tile).

logical, private :: fx_open = .false.

A group is open (between begin and end).

integer, private, allocatable :: fx_peer_rank(:)

Compute-comm rank of each peer.

type(fold_plan_t), private :: fx_plan

Host copy of the routing plan.

integer, private :: fx_poff(FOLD_NFAM) = 0

Pack cursor: slabs packed per family in the open group.

integer, private :: fx_px = 1

Tiles along x.

integer, private :: fx_r0(FOLD_NFAM) = 0

Start of each family’s block in the flat receive arrays.

real(kind=wp), private, allocatable :: fx_rbuf(:)

Send / receive buffers, fx_cap values per peer region.

integer, private, allocatable :: fx_rcls(:)

Receive entries: destination column, peer, position, fold-row class.

integer, private, allocatable :: fx_rcol(:)

Receive entries: destination column, peer, position, fold-row class.

integer, private, allocatable :: fx_re(:)

Receive entries: destination column, peer, position, fold-row class.

type(request_t), private, allocatable :: fx_reqs(:)

MPI requests (2 per peer).

integer, private, allocatable :: fx_rn(:,:)

Receive counts (npeer, FOLD_NFAM).

integer, private, allocatable :: fx_rpeer(:)

Receive entries: destination column, peer, position, fold-row class.

integer, private :: fx_ry = 0

This rank’s y coordinate (the north row).

integer, private :: fx_s0(FOLD_NFAM) = 0

Start of each family’s block in the flat send arrays.

real(kind=wp), private, allocatable :: fx_sbuf(:)

Send / receive buffers, fx_cap values per peer region.

integer, private, allocatable :: fx_scol(:)

Send entries: source column, peer index, position in its list.

integer, private, allocatable :: fx_se(:)

Send entries: source column, peer index, position in its list.

integer, private :: fx_self = 0

Peer index of this tile (0 if not a peer).

logical, private :: fx_sent = .false.

The open group has been exchanged (packing closed).

integer, private :: fx_slab_cap = 0

Per-peer capacity in (row x layer) slabs of fx_nmax entries.

integer, private, allocatable :: fx_sn(:,:)

Send counts (npeer, FOLD_NFAM).

integer, private, allocatable :: fx_speer(:)

Send entries: source column, peer index, position in its list.

type(MPI_Status), private, allocatable :: fx_stats(:)

MPI statuses (2 per peer).

integer, private :: fx_uoff(FOLD_NFAM) = 0

Unpack cursor: slabs unpacked per family in the open group.


Interfaces

public interface ocean_fold_north_centre

  • private subroutine fold_centre_2d(fld, nxt, nyt, nx_phys, ny_phys, ng, device_resident)

    Cell-centred 2D north fold (copy).

    Arguments

    Type IntentOptional Attributes Name
    real(kind=wp), intent(inout) :: fld(nxt,nyt)

    Cell-centred field (nx_total, ny_total).

    integer, intent(in) :: nxt
    integer, intent(in) :: nyt
    integer, intent(in) :: nx_phys
    integer, intent(in) :: ny_phys
    integer, intent(in) :: ng
    logical, intent(in), optional :: device_resident

    Exchange path only: .false. ⇒ host arrays.

  • private subroutine fold_centre_3d(fld, nxt, nyt, nz, nx_phys, ny_phys, ng, device_resident)

    Cell-centred 3D north fold (copy).

    Arguments

    Type IntentOptional Attributes Name
    real(kind=wp), intent(inout) :: fld(nxt,nyt,nz)

    Cell-centred field (nx_total, ny_total, nz).

    integer, intent(in) :: nxt
    integer, intent(in) :: nyt
    integer, intent(in) :: nz
    integer, intent(in) :: nx_phys
    integer, intent(in) :: ny_phys
    integer, intent(in) :: ng
    logical, intent(in), optional :: device_resident

    Exchange path only: .false. ⇒ host arrays.

public interface ocean_fold_north_corner

  • private subroutine fold_corner_2d(fld, nxf, nyf, nx_phys, ny_phys, ng, negate, device_resident)

    SW-corner 2D north fold (+ fold-line projection); negate for a true-vector component, copy for a scalar / vorticity.

    Arguments

    Type IntentOptional Attributes Name
    real(kind=wp), intent(inout) :: fld(nxf,nyf)

    Corner field (nx_total+1, ny_total+1).

    integer, intent(in) :: nxf
    integer, intent(in) :: nyf
    integer, intent(in) :: nx_phys
    integer, intent(in) :: ny_phys
    integer, intent(in) :: ng
    logical, intent(in) :: negate

    .true. ⇒ negate (true vector); .false. ⇒ copy.

    logical, intent(in), optional :: device_resident

    Exchange path only: .false. ⇒ host arrays.

public interface ocean_fold_north_u_face

  • private subroutine fold_u_2d(fld, nxf, nyt, nx_phys, ny_phys, ng, device_resident)

    x-face (u) 2D north fold (negate).

    Arguments

    Type IntentOptional Attributes Name
    real(kind=wp), intent(inout) :: fld(nxf,nyt)

    x-face field (nx_total+1, ny_total).

    integer, intent(in) :: nxf
    integer, intent(in) :: nyt
    integer, intent(in) :: nx_phys
    integer, intent(in) :: ny_phys
    integer, intent(in) :: ng
    logical, intent(in), optional :: device_resident

    Exchange path only: .false. ⇒ host arrays.

  • private subroutine fold_u_3d(fld, nxf, nyt, nz, nx_phys, ny_phys, ng, device_resident)

    x-face (u) 3D north fold (negate).

    Arguments

    Type IntentOptional Attributes Name
    real(kind=wp), intent(inout) :: fld(nxf,nyt,nz)

    x-face field (nx_total+1, ny_total, nz).

    integer, intent(in) :: nxf
    integer, intent(in) :: nyt
    integer, intent(in) :: nz
    integer, intent(in) :: nx_phys
    integer, intent(in) :: ny_phys
    integer, intent(in) :: ng
    logical, intent(in), optional :: device_resident

    Exchange path only: .false. ⇒ host arrays.

public interface ocean_fold_north_v_face

  • private subroutine fold_v_2d(fld, nxt, nyf, nx_phys, ny_phys, ng, device_resident)

    y-face (v) 2D north fold (negate + fold-line projection).

    Arguments

    Type IntentOptional Attributes Name
    real(kind=wp), intent(inout) :: fld(nxt,nyf)

    y-face field (nx_total, ny_total+1).

    integer, intent(in) :: nxt
    integer, intent(in) :: nyf
    integer, intent(in) :: nx_phys
    integer, intent(in) :: ny_phys
    integer, intent(in) :: ng
    logical, intent(in), optional :: device_resident

    Exchange path only: .false. ⇒ host arrays.

  • private subroutine fold_v_3d(fld, nxt, nyf, nz, nx_phys, ny_phys, ng, device_resident)

    y-face (v) 3D north fold (negate + fold-line projection).

    Arguments

    Type IntentOptional Attributes Name
    real(kind=wp), intent(inout) :: fld(nxt,nyf,nz)

    y-face field (nx_total, ny_total+1, nz).

    integer, intent(in) :: nxt
    integer, intent(in) :: nyf
    integer, intent(in) :: nz
    integer, intent(in) :: nx_phys
    integer, intent(in) :: ny_phys
    integer, intent(in) :: ng
    logical, intent(in), optional :: device_resident

    Exchange path only: .false. ⇒ host arrays.

public interface ocean_fold_pack

  • private subroutine ocean_fold_pack_2d(fld, nxa, nya, stagger, device_resident)

    Pack a 2D field of storage shape (nxa, nya) into the open group.

    Arguments

    Type IntentOptional Attributes Name
    real(kind=wp), intent(in) :: fld(nxa,nya)

    Field (T: nxt x nyt; u: nxt+1 x nyt; v: nxt x nyt+1; corner: nxt+1 x nyt+1).

    integer, intent(in) :: nxa

    Storage extents of fld.

    integer, intent(in) :: nya

    Storage extents of fld.

    integer, intent(in) :: stagger

    FOLD_STAG_*.

    logical, intent(in), optional :: device_resident

    .false. ⇒ host arrays; default device-resident.

  • private subroutine ocean_fold_pack_3d(fld, nxa, nya, nz, stagger, device_resident)

    Pack every layer of a 3D field into the open group: the sender’s owned mirror-source points, rows below (and, for v / corner, on) the fold line.

    Arguments

    Type IntentOptional Attributes Name
    real(kind=wp), intent(in) :: fld(nxa,nya,nz)

    Field; see ocean_fold_pack_2d for the per-stagger shape.

    integer, intent(in) :: nxa

    Storage extents of fld.

    integer, intent(in) :: nya

    Storage extents of fld.

    integer, intent(in) :: nz

    Storage extents of fld.

    integer, intent(in) :: stagger

    FOLD_STAG_*.

    logical, intent(in), optional :: device_resident

    .false. ⇒ host arrays; default device-resident.

public interface ocean_fold_unpack

  • private subroutine ocean_fold_unpack_2d(fld, nxa, nya, stagger, negate, device_resident)

    Unpack the next field of the exchanged group into a 2D field.

    Arguments

    Type IntentOptional Attributes Name
    real(kind=wp), intent(inout) :: fld(nxa,nya)

    Field; same stagger and order as at pack.

    integer, intent(in) :: nxa

    Storage extents of fld.

    integer, intent(in) :: nya

    Storage extents of fld.

    integer, intent(in) :: stagger

    FOLD_STAG_*.

    logical, intent(in) :: negate

    .true. for a true-vector component (sign flips across the fold).

    logical, intent(in), optional :: device_resident

    .false. ⇒ host arrays; default device-resident.

  • private subroutine ocean_fold_unpack_3d(fld, nxa, nya, nz, stagger, negate, device_resident)

    Unpack the next field of the exchanged group: write every north ghost row (all storage columns) and, for v / corner, the fold-line row’s west half (self-conjugate column → 0 for a vector).

    Arguments

    Type IntentOptional Attributes Name
    real(kind=wp), intent(inout) :: fld(nxa,nya,nz)

    Field; same stagger and order as at pack.

    integer, intent(in) :: nxa

    Storage extents of fld.

    integer, intent(in) :: nya

    Storage extents of fld.

    integer, intent(in) :: nz

    Storage extents of fld.

    integer, intent(in) :: stagger

    FOLD_STAG_*.

    logical, intent(in) :: negate

    .true. for a true-vector component.

    logical, intent(in), optional :: device_resident

    .false. ⇒ host arrays; default device-resident.


Functions

public pure function ocean_fold_is_distributed() result(flag)

True iff this rank folds through the exchange (px > 1 and a folded north edge on this rank). False on every px = 1 run and on ranks off the north row.

Arguments

None

Return Value logical


Subroutines

public subroutine ocean_fold_begin(nslab)

Open a group of nslab (rows x layers) slabs in total (an upper bound is fine). Grows the buffers, with a warning, if the run did not reserve enough. No-op when inactive.

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: nslab

Sum over the group’s fields of rows x layers.

public subroutine ocean_fold_end()

Close the group: every packed slab must have been unpacked.

Arguments

None

public subroutine ocean_fold_exchange(device_resident)

Move every packed message: one isend + irecv per non-self peer with a non-empty message, the self pair as a local copy, then waitall. Collective over the north rank row.

Arguments

Type IntentOptional Attributes Name
logical, intent(in), optional :: device_resident

.false. ⇒ host buffers; default device-resident.

public subroutine ocean_fold_exchange_destroy()

Release the plan, buffers and topology. Idempotent.

Arguments

None

public subroutine ocean_fold_exchange_init(decomp, nghost, north_fold, ierr)

Record the topology and, on a north-row rank of an east-west split folded grid, build the routing plan and map it to the device. Every rank may call it (it is not collective); a rank that does not fold, or a px = 1 run, keeps the exchange inactive.

Arguments

Type IntentOptional Attributes Name
type(decomp_t), intent(in) :: decomp

Domain decomposition.

integer, intent(in) :: nghost

Ghost width.

logical, intent(in) :: north_fold

This rank folds its north edge (bc%north_fold, rank-local).

integer, intent(out), optional :: ierr

OCEAN_STATUS_ERR_SETUP when the plan cannot be built (more tiles than fold-row columns); absent ⇒ error stop.

public subroutine ocean_fold_exchange_reserve(nslab)

Pre-size the buffers for the largest group of the run, in (row x layer) slabs summed over its fields — e.g. the ml_state group is (3 + ntracer)*nz fields of at most ng+1 rows — so no device reallocation fires mid-run. No-op when inactive or already large enough.

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: nslab

Total (rows x layers) over the fields of the largest group.

private subroutine fold_centre_2d(fld, nxt, nyt, nx_phys, ny_phys, ng, device_resident)

Cell-centred 2D north fold (copy).

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(inout) :: fld(nxt,nyt)

Cell-centred field (nx_total, ny_total).

integer, intent(in) :: nxt
integer, intent(in) :: nyt
integer, intent(in) :: nx_phys
integer, intent(in) :: ny_phys
integer, intent(in) :: ng
logical, intent(in), optional :: device_resident

Exchange path only: .false. ⇒ host arrays.

private subroutine fold_centre_3d(fld, nxt, nyt, nz, nx_phys, ny_phys, ng, device_resident)

Cell-centred 3D north fold (copy).

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(inout) :: fld(nxt,nyt,nz)

Cell-centred field (nx_total, ny_total, nz).

integer, intent(in) :: nxt
integer, intent(in) :: nyt
integer, intent(in) :: nz
integer, intent(in) :: nx_phys
integer, intent(in) :: ny_phys
integer, intent(in) :: ng
logical, intent(in), optional :: device_resident

Exchange path only: .false. ⇒ host arrays.

private subroutine fold_corner_2d(fld, nxf, nyf, nx_phys, ny_phys, ng, negate, device_resident)

SW-corner 2D north fold (+ fold-line projection); negate for a true-vector component, copy for a scalar / vorticity.

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(inout) :: fld(nxf,nyf)

Corner field (nx_total+1, ny_total+1).

integer, intent(in) :: nxf
integer, intent(in) :: nyf
integer, intent(in) :: nx_phys
integer, intent(in) :: ny_phys
integer, intent(in) :: ng
logical, intent(in) :: negate

.true. ⇒ negate (true vector); .false. ⇒ copy.

logical, intent(in), optional :: device_resident

Exchange path only: .false. ⇒ host arrays.

private subroutine fold_u_2d(fld, nxf, nyt, nx_phys, ny_phys, ng, device_resident)

x-face (u) 2D north fold (negate).

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(inout) :: fld(nxf,nyt)

x-face field (nx_total+1, ny_total).

integer, intent(in) :: nxf
integer, intent(in) :: nyt
integer, intent(in) :: nx_phys
integer, intent(in) :: ny_phys
integer, intent(in) :: ng
logical, intent(in), optional :: device_resident

Exchange path only: .false. ⇒ host arrays.

private subroutine fold_u_3d(fld, nxf, nyt, nz, nx_phys, ny_phys, ng, device_resident)

x-face (u) 3D north fold (negate).

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(inout) :: fld(nxf,nyt,nz)

x-face field (nx_total+1, ny_total, nz).

integer, intent(in) :: nxf
integer, intent(in) :: nyt
integer, intent(in) :: nz
integer, intent(in) :: nx_phys
integer, intent(in) :: ny_phys
integer, intent(in) :: ng
logical, intent(in), optional :: device_resident

Exchange path only: .false. ⇒ host arrays.

private subroutine fold_v_2d(fld, nxt, nyf, nx_phys, ny_phys, ng, device_resident)

y-face (v) 2D north fold (negate + fold-line projection).

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(inout) :: fld(nxt,nyf)

y-face field (nx_total, ny_total+1).

integer, intent(in) :: nxt
integer, intent(in) :: nyf
integer, intent(in) :: nx_phys
integer, intent(in) :: ny_phys
integer, intent(in) :: ng
logical, intent(in), optional :: device_resident

Exchange path only: .false. ⇒ host arrays.

private subroutine fold_v_3d(fld, nxt, nyf, nz, nx_phys, ny_phys, ng, device_resident)

y-face (v) 3D north fold (negate + fold-line projection).

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(inout) :: fld(nxt,nyf,nz)

y-face field (nx_total, ny_total+1, nz).

integer, intent(in) :: nxt
integer, intent(in) :: nyf
integer, intent(in) :: nz
integer, intent(in) :: nx_phys
integer, intent(in) :: ny_phys
integer, intent(in) :: ng
logical, intent(in), optional :: device_resident

Exchange path only: .false. ⇒ host arrays.

private subroutine grow_buffers(nslab)

(Re)allocate both buffers for nslab slabs per peer (exit-delete / dealloc / alloc / enter-create, as ocean_halo_buffers_ensure_nz). Never while a group is open.

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: nslab

private subroutine ocean_fold_pack_2d(fld, nxa, nya, stagger, device_resident)

Pack a 2D field of storage shape (nxa, nya) into the open group.

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: fld(nxa,nya)

Field (T: nxt x nyt; u: nxt+1 x nyt; v: nxt x nyt+1; corner: nxt+1 x nyt+1).

integer, intent(in) :: nxa

Storage extents of fld.

integer, intent(in) :: nya

Storage extents of fld.

integer, intent(in) :: stagger

FOLD_STAG_*.

logical, intent(in), optional :: device_resident

.false. ⇒ host arrays; default device-resident.

private subroutine ocean_fold_pack_3d(fld, nxa, nya, nz, stagger, device_resident)

Pack every layer of a 3D field into the open group: the sender’s owned mirror-source points, rows below (and, for v / corner, on) the fold line.

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: fld(nxa,nya,nz)

Field; see ocean_fold_pack_2d for the per-stagger shape.

integer, intent(in) :: nxa

Storage extents of fld.

integer, intent(in) :: nya

Storage extents of fld.

integer, intent(in) :: nz

Storage extents of fld.

integer, intent(in) :: stagger

FOLD_STAG_*.

logical, intent(in), optional :: device_resident

.false. ⇒ host arrays; default device-resident.

private subroutine ocean_fold_unpack_2d(fld, nxa, nya, stagger, negate, device_resident)

Unpack the next field of the exchanged group into a 2D field.

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(inout) :: fld(nxa,nya)

Field; same stagger and order as at pack.

integer, intent(in) :: nxa

Storage extents of fld.

integer, intent(in) :: nya

Storage extents of fld.

integer, intent(in) :: stagger

FOLD_STAG_*.

logical, intent(in) :: negate

.true. for a true-vector component (sign flips across the fold).

logical, intent(in), optional :: device_resident

.false. ⇒ host arrays; default device-resident.

private subroutine ocean_fold_unpack_3d(fld, nxa, nya, nz, stagger, negate, device_resident)

Unpack the next field of the exchanged group: write every north ghost row (all storage columns) and, for v / corner, the fold-line row’s west half (self-conjugate column → 0 for a vector).

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(inout) :: fld(nxa,nya,nz)

Field; same stagger and order as at pack.

integer, intent(in) :: nxa

Storage extents of fld.

integer, intent(in) :: nya

Storage extents of fld.

integer, intent(in) :: nz

Storage extents of fld.

integer, intent(in) :: stagger

FOLD_STAG_*.

logical, intent(in) :: negate

.true. for a true-vector component.

logical, intent(in), optional :: device_resident

.false. ⇒ host arrays; default device-resident.