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

Contains module m_amr_cluster. More...

Go to the source code of this file.

Modules

module  m_amr_cluster
 Berger-Rigoutsos clustering of a sparse tag list into separated block boxes, identically on every rank: tag signatures, bisection, canonical Morton order and min-separation merge.

Functions/Subroutines

impure subroutine m_amr_cluster::s_amr_box_sig (tags, ts, te, blo0, bhi0, sig, off, nsig)
 Concatenated 1D tag signatures of box [blo0:bhi0] from tags ts:te: sig(off(d) + t - blo0(d)) counts the in-box tagged cells at position t along d. One signature serves the trim, the count and every split. nsig is the used length.
pure subroutine m_amr_cluster::s_amr_trim_from_sig (sig, off, blo0, bhi0, blo, bhi, ok, ntag)
 Shrink box [blo:bhi] to the tight bbox of its tagged cells (first/last nonzero of each axis signature) and return their count; ok = .false. if none tagged.
pure subroutine m_amr_cluster::s_amr_find_split_sig (sig, off, blo0, blo, bhi, sax, spos, ok)
 Bisect a trimmed box: on the longest splittable axis prefer the widest zero-signature hole, else the strongest signature inflection (Laplacian sign change). ok = .false. if no axis admits a split leaving both children >= min_child cells.
pure subroutine m_amr_cluster::s_cl_partition (wt, ts, te, sax, spos, lo)
 Partition wt(:, ts:te) in place by coord(sax) < spos; the low child is ts:lo-1 and the high child lo:te.
impure subroutine m_amr_cluster::s_cl_exchange (tagc, np2, sb, sc, sd, rb, rc, rd)
 Nonblocking exchange: receive rc(q) words into rb at rd(q) and send sc(q) words from sb at sd(q), per peer plist(q).
impure subroutine m_amr_cluster::s_cl_add_peer (rr, np2)
 Register rank rr as a peer of the narrow reduction if not yet listed.
impure subroutine m_amr_cluster::s_cl_reduce_depth (nbat, bsig, bofs, blen, bnov, bwide, bovr)
 Sum the depth's batched signatures across ranks. Wide nodes (every rank overlaps) ride one ALLREDUCE. Narrow nodes reduce point-to-point within their small rank brick: members send to the root bovr(1,:), which sums and sends the total back. Both ends enumerate nodes in the same global order, so one aggregated message per peer per phase matches without negotiation.
impure subroutine m_amr_cluster::s_cl_union (alo, ahi, nacc)
 Union the per-rank accepted boxes (rank-local subtrees are walked only by their owner). Rank order is not serial acceptance order; the Morton sort that follows removes the dependence. alo/ahi grow to the union (the cap applies to the merged set).
impure subroutine m_amr_cluster::s_cl_bisect (tags, ntag_in, reduce, alo, ahi, nacc, capped)
 Level-order Berger-Rigoutsos descent: accepts boxes into alo/ahi(:, 1:nacc). Every shared node of a depth rides one reduction, so the collective count is O(tree depth). A child's overlapping ranks are a subset of its parent's, so every rank walks the whole shared subtree in the same order. Children are appended past ncur and shifted down when the depth closes (peak occupancy 3*ncur <= the 4*cap + 8 the arrays carry).
impure subroutine m_amr_cluster::s_cl_morton_sort (alo, ahi, nacc)
 Sort boxes by the Morton key of lo so the merge input depends on the box set alone, not on the rank-dependent acceptance order. Accepted boxes are disjoint, so the keys are distinct; the sort is stable for any collision.
impure subroutine m_amr_cluster::s_cl_merge (alo, ahi, nacc)
 Min-separation merge: two boxes are separated only if some active dim's gap reaches thr; else fuse to their bounding box. Fusing only shrinks gaps, so the fixed point (groups with mutually separated bounding boxes) does not depend on the fusion order; a group keeps its lowest index, so the output order does not either. Each box in list order sweeps the 3^d bins around its lo (bin width ext_max + thr holds every too-close partner), absorbs every later box found too close and is absorbed by the lowest earlier one, until a sweep finds nothing. Bins are rebuilt when a grown box outgrows the cell width.
subroutine s_mrg_build ()
integer function f_mrg_binof (ii)
subroutine s_mrg_binreg (ii)
subroutine s_mrg_binun (ii)
subroutine s_mrg_fuse (x, y)
subroutine s_mrg_sweep (ii, below, nfused)
 One sweep of the bins around box ii: fuse every too-close later box into it (nfused of them) and return the lowest too-close earlier box in below (0 if none). ii grows during the sweep, so the caller repeats until nothing is found.
impure subroutine, public m_amr_cluster::s_amr_cluster (tags, ntag_in, boxes, nboxes, reduce)
 Cluster a sparse tag list tags(1:3, 1:ntag_in) of level-0 cell coords into separated block boxes, identically on every rank. Berger-Rigoutsos bisection until a box's tag efficiency reaches amr_cluster_eff (or it is atomic or the amr_max_blocks cap is hit), then merge boxes whose amr_buf-padded extents come within buff_size. Boxes are raw tagged extents; the caller pads, clamps and size-caps each. reduce: tags is this rank's local list and node signatures are reduced across ranks; otherwise tags is already replicated.

Variables

integer, parameter m_amr_cluster::amr_cl_wide = 8
 A node is wide when its box spans more ranks than this; wide nodes use the batched collective, narrow ones reduce among their few overlapping ranks. 8 is one 2x2x2 brick of ranks.
integer, dimension(:), allocatable m_amr_cluster::pidx
 Scratch of the narrow point-to-point reduction (pidx is all-zero between depths).
integer, dimension(:), allocatable m_amr_cluster::plist
integer, dimension(:), allocatable m_amr_cluster::scnt
integer, dimension(:), allocatable m_amr_cluster::rcnt
integer, dimension(:), allocatable m_amr_cluster::sdsp2
integer, dimension(:), allocatable m_amr_cluster::rdsp2
integer, dimension(:), allocatable m_amr_cluster::soff
integer, dimension(:), allocatable m_amr_cluster::roff
integer, dimension(:), allocatable m_amr_cluster::sbuf
integer, dimension(:), allocatable m_amr_cluster::rbuf
integer, dimension(:), allocatable m_amr_cluster::creq
integer, dimension(:), allocatable m_amr_cluster::wbuf

Detailed Description

Contains module m_amr_cluster.

Definition in file m_amr_cluster.fpp.f90.

Function/Subroutine Documentation

◆ f_mrg_binof()

integer function s_cl_merge::f_mrg_binof ( integer, intent(in) ii)
private

Definition at line 951 of file m_amr_cluster.fpp.f90.

Here is the caller graph for this function:

◆ s_mrg_binreg()

subroutine s_cl_merge::s_mrg_binreg ( integer, intent(in) ii)
private

Definition at line 961 of file m_amr_cluster.fpp.f90.

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

◆ s_mrg_binun()

subroutine s_cl_merge::s_mrg_binun ( integer, intent(in) ii)
private

Definition at line 975 of file m_amr_cluster.fpp.f90.

Here is the caller graph for this function:

◆ s_mrg_build()

subroutine s_cl_merge::s_mrg_build
private

Definition at line 914 of file m_amr_cluster.fpp.f90.

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

◆ s_mrg_fuse()

subroutine s_cl_merge::s_mrg_fuse ( integer, intent(in) x,
integer, intent(in) y )
private

Definition at line 988 of file m_amr_cluster.fpp.f90.

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

◆ s_mrg_sweep()

subroutine s_cl_merge::s_mrg_sweep ( integer, intent(in) ii,
integer, intent(out) below,
integer, intent(out) nfused )
private

One sweep of the bins around box ii: fuse every too-close later box into it (nfused of them) and return the lowest too-close earlier box in below (0 if none). ii grows during the sweep, so the caller repeats until nothing is found.

Definition at line 1002 of file m_amr_cluster.fpp.f90.

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