MFC
Exascale flow solver
Loading...
Searching...
No Matches
m_amr_store.fpp.f90 File Reference

Contains module m_amr_store. More...

Go to the source code of this file.

Modules

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

Functions/Subroutines

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.
impure subroutine, public m_amr_store::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 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.
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.
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.
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).
impure subroutine, public m_amr_store::s_amr_free_swap_buffers ()
impure subroutine m_amr_store::s_amr_loc_index_init ()
 Allocate/reset the dense local-index maps (idempotent).
impure subroutine m_amr_store::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 m_amr_store::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 m_amr_store::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 m_amr_store::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.
logical function f_fits (c)
 Device staging of a growth to cap c leaves amr_grow_dev_bytes free (false when free memory is unknown).
impure subroutine, public m_amr_store::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 m_amr_store::s_amr_br_store (loc)
impure subroutine, public m_amr_store::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 m_amr_store::s_amr_br_store_faces (loc, olo, ohi, glo, ghi, woff, w_lo, w_hi)
impure subroutine, public m_amr_store::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 m_amr_store::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 m_amr_store::s_amr_st_finalize ()
 Free the flat store and dense-index maps (idempotent; called from both finalize paths).
impure subroutine, public m_amr_store::s_amr_alloc_slot (islot)
 Allocate slot islot's coords and its dense store index (idempotent).
impure subroutine, public m_amr_store::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 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.

Variables

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.

Detailed Description

Contains module m_amr_store.

Definition in file m_amr_store.fpp.f90.

Function/Subroutine Documentation

◆ f_fits()

logical function s_amr_st_reserve::f_fits ( integer, intent(in) c)

Device staging of a growth to cap c leaves amr_grow_dev_bytes free (false when free memory is unknown).

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

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