MFC
Exascale flow solver
Loading...
Searching...
No Matches
m_amr_store Module Reference

Flat per-block field store: dense slot indexing, reservation, alloc/free and the prim/bridge loaders. More...

Functions/Subroutines

impure subroutine, public s_amr_sync_grid_state_to_device ()
 Push the host global grid state (m/n/p, idwint/idwbuff, coordinate arrays) to its GPU_DECLARE'd device copies after a swap/restore. Coordinates go through amr_gs_buf as one update since each allocatable update costs several synchronous copies. No-op on CPU.
impure subroutine, public s_amr_copy_fine_fields (k)
 Device copy amr_cons_st -> amr_stor_st over block k's buffered box, all sys_size fields (RK step-entry backup).
impure subroutine, public s_amr_alloc_pool ()
 Block-metadata pool for amr_max_blocks slots (geometry, ownership, level, SFC cuts, overlap-list counts; the 2D rank lists are sized in s_amr_build_seam_pairs) and the dense-index maps.
impure subroutine, public s_amr_init_swap_buffers ()
 Bounce buffers for the copy-based coordinate swap; shaped like the base-level *_alloc arrays, since they are assigned whole to/from x_cb etc.
impure subroutine, public s_amr_free_pool ()
 Free what s_amr_alloc_pool allocated (plus the per-block caches sized later), and the coordinate swap buffers.
impure subroutine, public s_amr_set_mbuf ()
 The buffered per-slot array bounds from the max fine extents (collapsed dims 0:0).
impure subroutine, public s_amr_free_swap_buffers ()
impure subroutine s_amr_loc_index_init ()
 Allocate/reset the dense local-index maps (idempotent).
impure subroutine s_amr_st_move_slot (src, dst)
 Move one local slot's store data src -> dst on the device, in place (a staging copy would transiently double the store). Ascending-source order (s_amr_compact_store) guarantees dst's old contents are consumed. The host copy goes stale, the store's normal state between rebuilds.
impure subroutine s_amr_compact_store ()
 Re-densify the local index space after every reconcile so amr_loc_n tracks the live count instead of ratcheting up with SFC window shifts and migration slots (capacity then plateaus at the rebuild transient). Moves are device-side and in place in ascending old-index order: each destination is <= its source and below every pending source. Called at the end of s_amr_reconcile_slots, after the rebuild's overlap carry-forward (which reads amr_stor_st at old indices) has finished.
impure subroutine, public s_amr_dev_mem (free_b, total_b)
 Free and total device memory in bytes (hipMemGetInfo on the AMD GPU build); -1 for both where there is no query.
impure subroutine s_amr_st_reserve (nloc)
 Size the flat store for at least nloc local slots, growing geometrically and never shrinking. Growth preserves the live columns on the device (no PCIe round trip); the host mirror comes out undefined.
impure subroutine, public s_amr_br_load (loc)
 Move block loc's conserved state between the flat store and the bridge over the whole buffered box (all slots share the mbuf extents).
impure subroutine, public s_amr_br_store (loc)
impure subroutine, public s_amr_br_load_faces (loc, olo, ohi, glo, ghi, woff, w_lo, w_hi)
 Face-bounded bridge move for the level>=2 reflux apply: moves only the six one-cell planes (outside cell olo(d)/ohi(d) of each active dim, over the caller's transverse window) that s_amr_reflux_apply_faces read-modify-writes, skipping zero-weight planes as the apply does. Bit-identical to a whole-box move.
impure subroutine, public s_amr_br_store_faces (loc, olo, ohi, glo, ghi, woff, w_lo, w_hi)
impure subroutine, public s_amr_br_load_batch (nb)
 Batched bridge load: every batch member (amr_bat_blk/amr_bat_loc, extents amr_bat_ext) lands at offset (ibm-1)*amr_bat_w along amr_bat_sd with its ghost shell, in one kernel. Nothing is stored back: s_compute_rhs does not write its cons dummy on the fine path.
impure subroutine, public s_amr_bat_member_prim (ibm, src, dst)
 Copy batch member ibm's primitive state from the slab scratch into the block-frame scratch over its buffered extent, for the per-member IB correction.
impure subroutine s_amr_st_finalize ()
 Free the flat store and dense-index maps (idempotent; called from both finalize paths).
impure subroutine, public s_amr_alloc_slot (islot)
 Allocate slot islot's coords and its dense store index (idempotent).
impure subroutine, public s_amr_free_slot (islot)
 Free slot islot's per-block field arrays (inverse of s_amr_alloc_slot). Idempotent (no-op if not live).
impure subroutine, public s_amr_reconcile_slots ()
 Reconcile allocated slots to current ownership: allocate every active block this rank owns, free the rest. Call after ownership is set; regrid must allocate its transient slots before this call.

Variables

real(wp), dimension(:), allocatable amr_gs_buf
 Staging for the coordinate push of s_amr_sync_grid_state_to_device: the active dims' cb/cc/d arrays back to back.

Detailed Description

Flat per-block field store: dense slot indexing, reservation, alloc/free and the prim/bridge loaders.

Function/Subroutine Documentation

◆ s_amr_alloc_pool()

impure subroutine, public m_amr_store::s_amr_alloc_pool

Block-metadata pool for amr_max_blocks slots (geometry, ownership, level, SFC cuts, overlap-list counts; the 2D rank lists are sized in s_amr_build_seam_pairs) and the dense-index maps.

Definition at line 1025 of file m_amr_store.fpp.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ s_amr_alloc_slot()

impure subroutine, public m_amr_store::s_amr_alloc_slot ( integer, intent(in) islot)

Allocate slot islot's coords and its dense store index (idempotent).

Definition at line 3680 of file m_amr_store.fpp.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ s_amr_bat_member_prim()

impure subroutine, public m_amr_store::s_amr_bat_member_prim ( integer, intent(in) ibm,
type(scalar_field), dimension(sys_size), intent(in) src,
type(scalar_field), dimension(sys_size), intent(inout) dst )

Copy batch member ibm's primitive state from the slab scratch into the block-frame scratch over its buffered extent, for the per-member IB correction.

Definition at line 2973 of file m_amr_store.fpp.f90.

Here is the caller graph for this function:

◆ s_amr_br_load()

impure subroutine, public m_amr_store::s_amr_br_load ( integer, intent(in) loc)

Move block loc's conserved state between the flat store and the bridge over the whole buffered box (all slots share the mbuf extents).

Definition at line 2338 of file m_amr_store.fpp.f90.

Here is the caller graph for this function:

◆ s_amr_br_load_batch()

impure subroutine, public m_amr_store::s_amr_br_load_batch ( integer, intent(in) nb)

Batched bridge load: every batch member (amr_bat_blk/amr_bat_loc, extents amr_bat_ext) lands at offset (ibm-1)*amr_bat_w along amr_bat_sd with its ghost shell, in one kernel. Nothing is stored back: s_compute_rhs does not write its cons dummy on the fine path.

Definition at line 2905 of file m_amr_store.fpp.f90.

Here is the caller graph for this function:

◆ s_amr_br_load_faces()

impure subroutine, public m_amr_store::s_amr_br_load_faces ( integer, intent(in) loc,
integer, dimension(3), intent(in) olo,
integer, dimension(3), intent(in) ohi,
integer, dimension(3), intent(in) glo,
integer, dimension(3), intent(in) ghi,
integer, dimension(3), intent(in) woff,
real(wp), dimension(3), intent(in) w_lo,
real(wp), dimension(3), intent(in) w_hi )

Face-bounded bridge move for the level>=2 reflux apply: moves only the six one-cell planes (outside cell olo(d)/ohi(d) of each active dim, over the caller's transverse window) that s_amr_reflux_apply_faces read-modify-writes, skipping zero-weight planes as the apply does. Bit-identical to a whole-box move.

Definition at line 2465 of file m_amr_store.fpp.f90.

Here is the caller graph for this function:

◆ s_amr_br_store()

impure subroutine, public m_amr_store::s_amr_br_store ( integer, intent(in) loc)

Definition at line 2399 of file m_amr_store.fpp.f90.

Here is the caller graph for this function:

◆ s_amr_br_store_faces()

impure subroutine, public m_amr_store::s_amr_br_store_faces ( integer, intent(in) loc,
integer, dimension(3), intent(in) olo,
integer, dimension(3), intent(in) ohi,
integer, dimension(3), intent(in) glo,
integer, dimension(3), intent(in) ghi,
integer, dimension(3), intent(in) woff,
real(wp), dimension(3), intent(in) w_lo,
real(wp), dimension(3), intent(in) w_hi )

Definition at line 2684 of file m_amr_store.fpp.f90.

Here is the caller graph for this function:

◆ s_amr_compact_store()

impure subroutine m_amr_store::s_amr_compact_store
private

Re-densify the local index space after every reconcile so amr_loc_n tracks the live count instead of ratcheting up with SFC window shifts and migration slots (capacity then plateaus at the rebuild transient). Moves are device-side and in place in ascending old-index order: each destination is <= its source and below every pending source. Called at the end of s_amr_reconcile_slots, after the rebuild's overlap carry-forward (which reads amr_stor_st at old indices) has finished.

Definition at line 1371 of file m_amr_store.fpp.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ s_amr_copy_fine_fields()

impure subroutine, public m_amr_store::s_amr_copy_fine_fields ( integer, intent(in) k)

Device copy amr_cons_st -> amr_stor_st over block k's buffered box, all sys_size fields (RK step-entry backup).

Parameters
[in]kblock slot (its flat-store column)

Definition at line 968 of file m_amr_store.fpp.f90.

Here is the caller graph for this function:

◆ s_amr_dev_mem()

impure subroutine, public m_amr_store::s_amr_dev_mem ( integer(8), intent(out) free_b,
integer(8), intent(out) total_b )

Free and total device memory in bytes (hipMemGetInfo on the AMD GPU build); -1 for both where there is no query.

Definition at line 1396 of file m_amr_store.fpp.f90.

Here is the caller graph for this function:

◆ s_amr_free_pool()

impure subroutine, public m_amr_store::s_amr_free_pool

Free what s_amr_alloc_pool allocated (plus the per-block caches sized later), and the coordinate swap buffers.

Definition at line 1143 of file m_amr_store.fpp.f90.

Here is the call graph for this function:

◆ s_amr_free_slot()

impure subroutine, public m_amr_store::s_amr_free_slot ( integer, intent(in) islot)

Free slot islot's per-block field arrays (inverse of s_amr_alloc_slot). Idempotent (no-op if not live).

Definition at line 3717 of file m_amr_store.fpp.f90.

Here is the caller graph for this function:

◆ s_amr_free_swap_buffers()

impure subroutine, public m_amr_store::s_amr_free_swap_buffers

Definition at line 1162 of file m_amr_store.fpp.f90.

◆ s_amr_init_swap_buffers()

impure subroutine, public m_amr_store::s_amr_init_swap_buffers

Bounce buffers for the copy-based coordinate swap; shaped like the base-level *_alloc arrays, since they are assigned whole to/from x_cb etc.

Definition at line 1042 of file m_amr_store.fpp.f90.

Here is the caller graph for this function:

◆ s_amr_loc_index_init()

impure subroutine m_amr_store::s_amr_loc_index_init
private

Allocate/reset the dense local-index maps (idempotent).

Definition at line 1250 of file m_amr_store.fpp.f90.

Here is the caller graph for this function:

◆ s_amr_reconcile_slots()

impure subroutine, public m_amr_store::s_amr_reconcile_slots

Reconcile allocated slots to current ownership: allocate every active block this rank owns, free the rest. Call after ownership is set; regrid must allocate its transient slots before this call.

Definition at line 3749 of file m_amr_store.fpp.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ s_amr_set_mbuf()

impure subroutine, public m_amr_store::s_amr_set_mbuf

The buffered per-slot array bounds from the max fine extents (collapsed dims 0:0).

Definition at line 1156 of file m_amr_store.fpp.f90.

Here is the caller graph for this function:

◆ s_amr_st_finalize()

impure subroutine m_amr_store::s_amr_st_finalize
private

Free the flat store and dense-index maps (idempotent; called from both finalize paths).

Definition at line 3034 of file m_amr_store.fpp.f90.

Here is the caller graph for this function:

◆ s_amr_st_move_slot()

impure subroutine m_amr_store::s_amr_st_move_slot ( integer, intent(in) src,
integer, intent(in) dst )
private

Move one local slot's store data src -> dst on the device, in place (a staging copy would transiently double the store). Ascending-source order (s_amr_compact_store) guarantees dst's old contents are consumed. The host copy goes stale, the store's normal state between rebuilds.

Definition at line 1261 of file m_amr_store.fpp.f90.

Here is the caller graph for this function:

◆ s_amr_st_reserve()

impure subroutine m_amr_store::s_amr_st_reserve ( integer, intent(in) nloc)
private

Size the flat store for at least nloc local slots, growing geometrically and never shrinking. Growth preserves the live columns on the device (no PCIe round trip); the host mirror comes out undefined.

device bytes kept free through a growth; without a free-memory query, the largest old store staged on the device

Definition at line 1410 of file m_amr_store.fpp.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ s_amr_sync_grid_state_to_device()

impure subroutine, public m_amr_store::s_amr_sync_grid_state_to_device

Push the host global grid state (m/n/p, idwint/idwbuff, coordinate arrays) to its GPU_DECLARE'd device copies after a swap/restore. Coordinates go through amr_gs_buf as one update since each allocatable update costs several synchronous copies. No-op on CPU.

Definition at line 408 of file m_amr_store.fpp.f90.

Here is the caller graph for this function:

Variable Documentation

◆ amr_gs_buf

real(wp), dimension(:), allocatable m_amr_store::amr_gs_buf

Staging for the coordinate push of s_amr_sync_grid_state_to_device: the active dims' cb/cc/d arrays back to back.

Definition at line 384 of file m_amr_store.fpp.f90.