---
title: 'ClusterGather: Locality-Aware Aggregation Mechanisms'
url: https://www.emergentmind.com/topics/clustergather
type: topic
---

# ClusterGather: Locality-Aware Aggregation Mechanisms

ClusterGather is a non-unified research term used for several locality-aware gather or clustering mechanisms. In high-performance communication, it denotes hierarchical all-gather designs that exploit shared memory either across MPI ranks on the same node or across thread blocks within a Hopper GPU cluster. In continuous gravitational-wave postprocessing, it denotes an adaptive clustering procedure that forms seed-centered candidate clusters in frequency–spin-down and sky coordinates. Related literatures on \(r\)-gather clustering and multi-agent gathering address adjacent mathematical problems—minimum-size clustering in metric spaces and rendezvous of mobile agents—but they do not define the same primitive or workflow [2007.06892; 2508.18850; 1707.02676; 2106.02685; 1902.01455].

## 1. Terminological scope

The term is best understood as a family of domain-specific constructions rather than a standardized abstraction. Across the cited works, “ClusterGather” refers either to an all-gather operation confined to a locality with explicit synchronization and shared storage, or to an adaptive clustering rule that collects nearby objects around a seed only when the local density profile supports doing so.

| Context | Object called ClusterGather | Core mechanism |
|---|---|---|
| Multi-core clusters | Hybrid MPI+MPI allgather | Shared-memory window per node plus leader-only inter-node `MPI_Allgatherv` |
| Hopper GPU LLM inference | Cluster-level all-gather primitive | DSMEM block-to-block exchange in \(\log_2 N\) rounds |
| Continuous-wave searches | Adaptive clustering procedure | Seed-centered over-density detection in F-space and S-space |

A related but distinct usage of “gather” appears in the \(r\)-gather problem, where the objective is to partition points into clusters of size at least \(r\) while minimizing the maximum radius. Another related usage appears in geometric consensus, where “gathering” means that all pairwise distances tend to zero. These neighboring formulations clarify the broader semantic field around ClusterGather, but they are not interchangeable with the communication primitives or adaptive clustering procedure described above [2106.02685; 1902.01455].

## 2. Hybrid MPI+MPI ClusterGather on multi-core clusters

In the MPI setting, ClusterGather is a hierarchical allgather designed for hybrid MPI+MPI codes that use MPI-3 shared-memory extensions for on-node parallelism. The construction begins by splitting `MPI_COMM_WORLD` into one shared-memory subcommunicator per node with `MPI_Comm_split_type(..., MPI_COMM_TYPE_SHARED, ...)`, selecting one leader per node, and then forming a bridge communicator containing exactly one rank per node with `MPI_Comm_split`. On the shared-memory communicator, all ranks call `MPI_Win_allocate_shared`; the leader allocates `P_total·m` elements for an allgather of \(m\)-element messages, while non-leaders allocate zero bytes and then recover the same base pointer via `MPI_Win_shared_query`. Each rank \(i\) sets `mybuf = baseptr + i·m`, writes its own \(m\) elements directly into that segment, and thereby avoids intra-node peer-to-peer copies [2007.06892].

The inter-node phase is executed only by leaders. They call `MPI_Allgatherv(mybuf, m, …, baseptr, recvcounts[], displs[], …)` on the bridge communicator, with `recvcounts[k] = m·(size of node k)` and `displs[k] = (starting offset of node k in baseptr)`. A barrier on the shared-memory communicator before the inter-node exchange ensures that every leader’s local block is ready; a second barrier after `MPI_Allgatherv` ensures that all on-node ranks observe the fully updated shared buffer. Because every on-node rank points into the same window, there is exactly one copy of each block of the result per node, and no on-node broadcast or local copy loop is invoked [2007.06892].

The cost model makes the intended savings explicit. For pure MPI allgather, memory per node is
\[
M_{\text{pure}} = p \cdot (P \cdot m),
\]
where \(P\) is the total number of MPI ranks and \(p\) is the number of ranks per node. For the hybrid MPI+MPI method, memory per node is
\[
M_{\text{hybrid}} = 1 \cdot (P \cdot m),
\]
so the memory reduction factor is approximately \(p\). The communication-time models are summarized as
\[
T_{\text{pure}} \simeq (\log P)\alpha + \beta m (P-1)
\]
and
\[
T_{\text{bridge}} \simeq (\log (P/p))\alpha + \beta (m p)\bigl((P/p)-1\bigr) + 2\gamma \log p,
\]
where \(\alpha\) is network latency, \(\beta\) is per-byte transmission time, and \(\gamma\) is a small shared-memory synchronization cost. The comparison given in the paper is that, if \(p>1\), the total \(\beta\)-bytes term in \(T_{\text{bridge}}\) is smaller by approximately \(p\), while the added overhead is two barriers of order \(O(\log p)\) [2007.06892].

The reported measurements validate these trade-offs on a Cray XC40 system using Cray MPI and on an NEC cluster using OpenMPI. In single-node tests with \(p\) up to \(24\), pure MPI latency grows linearly with \(m\), whereas the hybrid method remains at a few microseconds; at \(m=32\text{K}\) elements, the reported example is approximately \(10\,\mu\text{s}\) for hybrid versus approximately \(50\,\mu\text{s}\) for pure MPI. In the mixed case on \(64\) nodes with \(p=3\ldots24\), hybrid overtakes pure once \(p\ge 3\) on OpenMPI at small \(m\), and always on Cray MPI for \(p\ge 2\). In an irregular case with \(42\) nodes with \(24\) ranks and one node with \(16\) ranks, hybrid remains at approximately \(15\,\mu\text{s}\) while pure rises to approximately \(60\,\mu\text{s}\). Application-level validation shows that hybrid SUMMA can be up to \(5\times\) faster at small block size \(b\) when all ranks lie on one node, and that hybrid BPMF reduces total runtime by up to \(10\%\) at \(1024\) cores while cumulative allgather time drops by approximately \(60\%\), barriers included [2007.06892].

## 3. ClusterGather as a Hopper on-chip collective primitive

In the LLM-inference setting, ClusterGather is a cluster-level all-gather primitive that runs entirely on-chip within a Hopper GPU thread-block cluster. The primitive is defined for up to \(N=16\) blocks, with \(N\) required to be a power of two. Each block owns a shared-memory buffer \(D_b\) of length \(N\cdot\text{size}\), with `D_b[0:size]` initially holding that block’s local segment. ClusterGather then replicates each block’s local data segment to every other block through the SM-to-SM interconnect, DSMEM, without off-chip global-memory round-trips [2508.18850].

The protocol is a binary-tree all-gather executed in \(\log_2 N\) rounds. At round \(r\), with `stride = 2^{r-1}`, block \(b\) computes
\[
\text{send\_to} = (b + \text{stride}) \bmod N,\qquad
\text{recv\_from} = (b - \text{stride} + N) \bmod N.
\]
Each block sends the prefix it has gathered so far, of length \(\text{size}\cdot \text{stride}\), to `send_to`, placing it at offset `stride * size` in the peer’s buffer; symmetrically, it receives the next chunk of the same size from `recv_from` into its own buffer at the same offset. A barrier-like wait guarantees visibility before the next round, and the stride doubles until it reaches \(N\). The semantics are strict: shared memory per block must accommodate \(N\cdot\text{size}\), all \(N\) blocks must participate, and no block may exit early [2508.18850].

The on-chip traffic formula given for all-gather is
\[
\text{Traffic}_{\text{Gather}}(\text{size},N)
= \text{size} \times (2^{(\log_2(N/2)+1)} - 1)\times N
= \text{size}\times (N-1)\times N.
\]
For comparison, the paired primitive ClusterReduce has
\[
\text{Traffic}_{\text{Reduce}}(\text{size},N)=\text{size}\times \log_2(N)\times N.
\]
The paper uses these formulas to guide which dimensions should be gathered and which reduced in the fused execution plan. It also distinguishes ClusterGather from standard CUDA intrinsics: warp intrinsics operate within a warp, `__syncthreads` and grid-level synchronization coordinate threads within a block, whereas ClusterGather leverages DSMEM for direct on-chip block-to-block transfer that is not exposed by standard CUDA C++ APIs [2508.18850].

Within ClusterFusion, ClusterGather is invoked after each block computes its local Q, K, and V segments:
\[
(Q_b,K_b,V_b) \leftarrow H_b \times W^{QKV}_b,\qquad
(Q_b,K_b,V_b) \leftarrow \text{ClusterGather}(Q_b,K_b,V_b).
\]
After that call, every block has the full Q, K, and V for its attention head, allowing the kernel to continue with per-block partial attention, ClusterReduce for softmax statistics, and the final \(A\cdot W^O\) projection while keeping intermediates on-chip. In the collective microbenchmark reported in Table 5, for a data size of \(32\text{ KB}\), off-chip gather takes \(6.26\,\mu\text{s}\) and on-chip ClusterGather takes \(3.90\,\mu\text{s}\), a \(1.60\times\) speedup; for \(256\text{ KB}\), the times are \(6.61\,\mu\text{s}\) and \(4.15\,\mu\text{s}\), a \(1.59\times\) speedup. The ablation in Figure 8 reports that disabling DSMEM increases end-to-end TPOT by up to \(33\%\). At the framework level, ClusterFusion reports an average \(1.61\times\) reduction in end-to-end latency on H100 GPUs across different models and configurations [2508.18850].

## 4. ClusterGather as adaptive candidate clustering in continuous-wave searches

In continuous gravitational-wave searches, ClusterGather denotes an adaptive clustering procedure for post-processing stage-1 candidates. The input is
\[
\chi_1=\{\kappa_\ell \equiv (\lambda_\ell,\Gamma_\ell): \Gamma_\ell \ge L\},
\]
where \(\lambda_\ell=(f_\ell,\dot f_\ell,\alpha_\ell,\delta_\ell)\) are template parameters and \(\Gamma_\ell\) is the detection statistic. Clustering proceeds iteratively: select the loudest candidate \(\kappa_{\text{seed}}\) with \(\Gamma \ge S\), form a cluster \(\phi_i\) around that seed, remove \(\phi_i\) from the current candidate set, and stop when no remaining candidate exceeds the seed threshold \(S\). Typical thresholds quoted in the procedure are \(L\approx 10.5\) and \(S\approx 12.0\) for \(2\mathcal F\), or \(L\approx 4.0\) and \(S\approx 5.5\) for \(\mathfrak{B}_{SGL}\) [1707.02676].

The method is explicitly two-space. In frequency–spin-down space, distances from the seed are measured by
\[
R^f_{i,k}=
\sqrt{
\left(\frac{f_k-f_\ell}{\Delta f}\right)^2+
\left(\frac{\dot f_k-\dot f_\ell}{\Delta \dot f}\right)^2
},
\]
so contours of constant \(R^f\) are ellipses in normalized \((f,\dot f)\) coordinates. Distances are binned into equal-area annuli with edges \(B_r=\sqrt r\,\mathfrak B\), where
\[
\mathfrak B = R^f_{i,\max}/\sqrt{n_F}.
\]
The histogram \(n(r)\) is smoothed by first fitting a superposition \(G(r)+S(r)\) of Gaussians and sinusoids and then re-fitting the result by a single Gaussian \(g_i^f(r)\). The first local minimum of \(g_i^f(r)\) near \(r=0\) yields the F-space cluster radius \(R_i^f=B_{r^\ast}\). The procedure then evaluates three hill parameters,
\[
P_i=R_i^f/R^f_{i,\max},\qquad
D_i=\frac{g_i^f(\mathfrak B)-g_i^f(R_i^f)}{g_i^f(\mathfrak B)},\qquad
G_i=\frac{|n(1)-g_i^f(\mathfrak B)|}{n(1)+g_i^f(\mathfrak B)},
\]
and accepts the F-cluster only if \(P_i\le P_{\max}\), \(D_i\ge D_{\min}\), and \(G_i\le G_{\max}\). Example values given are \(P_{\max}=0.25\), \(D_{\min}=0.05\), and \(G_{\max}=0.1\). If the test fails, the radius is reset to \(\mathfrak B\), which restricts the shortlist to the first bin [1707.02676].

In sky space, the procedure transforms \((\alpha,\delta)\) to a uniform plane \((x,y)\) and defines
\[
R^s_{i,k}=\sqrt{(x_k-x_{\text{seed}})^2+(y_k-y_{\text{seed}})^2}.
\]
Sky annuli have edges \(B_r^s=\sqrt r\,\mathfrak B_s\), with
\[
\mathfrak B_s = \frac{(N^{99}+\Delta N)}{2}\,d_{\text{sky}},
\]
where \(N^{99}\) is the \(99\%\) containment diameter and \(\Delta N\) is a tuning term that may increase with seed loudness. If the first sky bin is the most populated, the smallest \(r^\ast\) satisfying
\[
\frac{n_s(r^\ast)-n_s(r^\ast+1)}{n_s(r^\ast)} > C_s
\]
with \(C_s\approx 0.25\) determines \(R_i^s=B^s_{r^\ast}\); otherwise \(R_i^s=0\), yielding a single-occupant sky cluster. The final cluster is
\[
\phi_i=\{\kappa_k:R^f_{i,k}\le R_i^f \;\text{and}\; R^s_{i,k}\le R_i^s\}\cup\{\kappa_{\text{seed}}\}.
\]
The stated rationale is that real CW signals produce a strong local over-density both in F-space and in sky, whereas noise disturbances often do not [1707.02676].

The computational trade-off differs sharply from the communication uses of ClusterGather. Per seed, AdCl performs \(O(N_i)\) distance computations, \(O(N_i)\) histogram binning, two-stage fitting, and hill checks, whereas fixed-volume clustering only requires distance computations and a simple radius cut. However, the adaptive method typically produces at most half as many clusters as fixed clustering, reducing downstream follow-up cost. In the Einstein@Home O1 results quoted in the summary, for the high-significance \(2\mathcal F\) search, AdCl has noise rejection approximately \(66\%\) versus old clustering at at most \(40\%\), with efficiency approximately \(97.6\%\) versus \(95.1\%\). In the sub-threshold \(\mathfrak{B}_{SGL}\) search, AdCl has noise rejection approximately \(90.5\%\) versus old clustering at at most \(74.1\%\) at efficiency approximately \(95\%\) [1707.02676].

## 5. Related gather and clustering formalisms

A neighboring formalism is the \(r\)-gather problem. Given a metric space \((\mathcal X,\mathrm{dist})\) and a point set \(P\subseteq\mathcal X\), an \(r\)-gather clustering is a partition
\[
P=P_1\cup \dots \cup P_t
\]
with centers \(c(P_i)\in\mathcal X\) such that \(|P_i|\ge r\) for all \(i\), and with objective
\[
\rho(P_1,\dots,P_t)=\max_{1\le i\le t}\max_{p\in P_i}\mathrm{dist}(p,c(P_i))
\]
minimized. The paper states that \(r\)-gather is NP-hard and has a tight \(3\)-approximation via Gonzalez–Shalita–Zwick. It then gives two algorithmic regimes beyond the usual offline setting: an MPC algorithm for Euclidean input points that computes an \(O((\log(1/\varepsilon)/\sqrt\gamma))\)-approximation in \(O(\log^\varepsilon n)\) rounds with total space \(O(n^{1+\gamma}d)\), and a fully dynamic algorithm in doubling metrics with amortized update time \(O(r\cdot 2^{O(d)}\log^2\Delta\log\log\Delta)\times\tau\) and query time \(O(2^{O(d)}\log^2\Delta)\times\tau\). These are minimum-size clustering results rather than ClusterGather collectives, but they formalize the “gather” motif as a radius-minimization problem under cardinality constraints [2106.02685].

A second adjacent body of work studies gathering as geometric consensus of mobile agents. In that literature, the gathering objective is
\[
\lim_{t\to\infty}\max_{i,j}\|x_i(t)-x_j(t)\|=0
\]
or its discrete-time analogue. The survey classifies eight systems by visibility range, sensing modality, and continuous versus discrete time. The listed results include exponential asymptotic gathering to the initial centroid for continuous infinite-visibility position sensing, asymptotic convergence in discrete time when \(0<\gamma<2/n\), finite-time gathering under infinite-visibility bearing-only dynamics, finite-time gathering to a single point for several limited-visibility models, and finite expected-time clustering into an \(R\)-disk for a randomized semi-synchronous bearing-only model. These results concern anonymous, oblivious agents in \(\mathbb R^d\), not shared-memory collectives or seed-based postprocessing, but they supply a formal notion of “gathering” that is conceptually adjacent to the uses above [1902.01455].

This broader landscape helps prevent a common conflation. ClusterGather in MPI or Hopper GPU papers is a communication primitive; ClusterGather in CW searches is a density-adaptive clustering rule; \(r\)-gather and multi-agent gathering are formal optimization or dynamical-system problems with different state spaces, guarantees, and cost models.

## 6. Comparative themes, constraints, and common misconceptions

The three direct ClusterGather usages share a common locality principle, but they operationalize it differently. In hybrid MPI+MPI, locality is the node: data are written once into a shared-memory window, leaders perform the inter-node exchange, and barriers protect data integrity. In Hopper GPUs, locality is the thread-block cluster: all blocks participate in a power-of-two binary-tree all-gather over DSMEM, with shared-memory buffers sized to hold the full gathered result. In CW postprocessing, locality is the seed neighborhood in two parameter spaces, and clustering is allowed to grow only while histogram shape and hill-parameter checks remain consistent with a signal-like over-density [2007.06892; 2508.18850; 1707.02676].

These usages also embody different optimization criteria. The MPI and GPU variants are explicitly bandwidth- and memory-traffic-oriented: both remove unnecessary copies, and both replace repeated off-locality movement with a structured local exchange. The CW variant is explicitly false-alarm- and follow-up-budget-oriented: it spends more work per seed on density estimation and consistency testing in order to reduce the number of downstream seeds. This suggests a shared design pattern—local aggregation with strict participation and validation rules—but not a shared objective function.

A frequent misconception is that ClusterGather denotes a single standardized API or algorithmic schema. The cited papers do not support that view. Another misconception is that “gather” always means an all-gather collective. The CW usage is not a communication primitive at all; it is an adaptive clustering procedure over candidate sets. Conversely, the \(r\)-gather and mobile-agent literatures should not be read as implementations of ClusterGather, even though they articulate mathematically precise gather or clustering objectives. A plausible implication is that the term is best treated as a family resemblance across locality-constrained aggregation problems rather than as a canonically defined operator.

From a systems perspective, the cited works converge on one practical lesson. When the relevant locality is exploited explicitly—whether by a shared-memory communicator, a bridge communicator of leaders, a DSMEM-resident block cluster, or a signal-consistent seed neighborhood—the resulting design can reduce redundant replication, suppress unnecessary movement, or narrow downstream search. The exact mechanism, however, remains domain-specific, and the term “ClusterGather” acquires its technical meaning only within that domain’s communication model, geometry, or statistical postprocessing pipeline.

Source: https://www.emergentmind.com/topics/clustergather