---
title: 'ArborX: Portable Geometric Search Library'
url: https://www.emergentmind.com/topics/arborx
type: topic
---

# ArborX: Portable Geometric Search Library

ArborX is a performance portable geometric search library built on top of Kokkos, originally introduced as an open-source C++ library for modern supercomputing architectures and later extended to support exascale applications and a broader algorithmic surface in version 2.0. Its core abstraction is a bounding-volume-hierarchy (BVH) index over geometric primitives, used to accelerate range, $k$-nearest-neighbor, collision, and ray queries, while preserving portability across host and device back ends through Kokkos execution and memory spaces. In the 2.0 release, ArborX exposes a unified C++20 API that runs efficiently on NVIDIA CUDA, AMD HIP, Intel SYCL, and multicore CPUs with OpenMP or Pthreads, and it adds a generalized interface, callbacks, distributed search, brute-force fallback, ray tracing, clustering, Euclidean minimum spanning tree (EMST), and moving-least-squares (MLS) interpolation [1908.11807] [2409.10743] [2507.23700].

## 1. Origins, objectives, and application domain

ArborX was developed to address a specific combination of requirements that earlier C++ spatial-index libraries did not target simultaneously: low-overhead parallel tree build, batched query execution on millions of points with predictable memory usage, and performance portability across multi-core CPUs, many-core GPUs, and future architectures [1908.11807]. The 2019 description places these requirements in scientific applications such as computational mechanics, multiphysics coupling, computer vision, cosmology, mesh searches, particle-in-cell, SPH, and Lagrangian-Eulerian couplers, where proximity search is a recurring kernel and brute-force all-pairs comparisons cost $O(n^2)$ [1908.11807].

The library’s later evolution was strongly shaped by exascale cosmology. The 2024 exascale paper describes ArborX as developed as part of the Exascale Computing Project (ECP), and it ties major enhancements to a collaboration with the HACC cosmology code, where in-situ halo finding is implemented with DBSCAN and each MPI rank handles hundreds of millions of particles [2409.10743]. That paper emphasizes that the pressure to support exascale supercomputers from different vendors required performance portability not only for the search index itself but also for the clustering workflow layered on top of it [2409.10743].

Version 2.0 broadens the scope beyond the original BVH-centric interface. The technical report characterizes the release by five design goals: generalized interface, callbacks, distributed search, expanded algorithms, and performance improvements [2507.23700]. A common misconception is that ArborX is only a BVH wrapper for 3D axis-aligned boxes. That description matches the 1.x API, but the 2.0 release explicitly expands the admissible value types, bounding volumes, problem dimensions, and query execution modes [2507.23700].

## 2. Core search structures and traversal model

The original ArborX design uses a binary BVH in which each node stores an axis-aligned bounding box (AABB) that encloses either two children or exactly one user primitive; in 3D, an AABB is represented by two points, $(x_{\min}, y_{\min}, z_{\min})$ and $(x_{\max}, y_{\max}, z_{\max})$ [1908.11807]. The 2019 paper describes a fully data-parallel, top-down “linear BVH” build driven by Morton codes, together with iterative stack-based search kernels for range and $k$-nearest-neighbor queries [1908.11807]. In ray-tracing literature, BVH quality is often discussed through the Surface Area Heuristic,
$$
\mathrm{SAH}(\text{node}) = C_{\mathrm{trav}} + \frac{S(A_{\mathrm{left}})}{S(A_{\mathrm{node}})} \cdot C_{\mathrm{left}} + \frac{S(A_{\mathrm{right}})}{S(A_{\mathrm{node}})} \cdot C_{\mathrm{right}},
$$
but the original ArborX implementation deliberately chose Morton-code splitting to keep build time low in settings where the tree is rebuilt frequently at each time-step [1908.11807].

The exascale paper gives a more implementation-centric account of the same index. It describes a GPU-ready BVH over $N$ primitives, stored in two contiguous arrays of size $2N-1$ in flattened form, with each node holding a $2 \times d$ array of doubles for the AABB, child indices or a rope index after stackless transformation, and leaf payloads as point indices or small lists of point indices [2409.10743]. That work emphasizes rope-based stackless traversal: the right-child pointer of an internal node is replaced with a rope, the index of the next subtree to traverse if the current node fails intersection tests, and every leaf also receives a rope [2409.10743]. Range queries then proceed as purely stackless traversals, while $k$-nearest searches use a per-thread min-heap of size $k$ plus a small stack of nodes still to be visited in distance order [2409.10743].

ArborX publications use different asymptotic descriptions for BVH construction. The 2019 paper states
$$
T_{\mathrm{build}}(n)=O(n\log n),
$$
with the parallel sort as the dominant cost [1908.11807]. The exascale paper describes Morton-code computation in $O(N)$ work, a parallel radix sort on Morton keys in $O(N)$ time with a small constant, Apetrei et al.’s $O(N)$ LBVH construction, and an $O(N)$ rope-recovery pass, summarizing this as $T_{\rm build}(N)=O(N)$ work, $O(\log N)$ span, memory $O(N)$ [2409.10743]. By contrast, the 2.0 technical report states “BVH build (Apetrei): $T_{\rm build}(N)=O(N \log N)$” and gives per-query traversal as approximately $O(\log N + k)$ [2507.23700]. This suggests that the literature is using different accounting conventions for the role of sorting, rather than presenting a single canonical asymptotic statement.

A similar historical variation appears in memory-layout descriptions. The 2019 paper emphasizes Structure-of-Arrays storage for node minima, maxima, and child indices [1908.11807]. The exascale paper describes an Array-of-Structs-of-Arrays (AoSoA) layout to balance vector-load efficiency with coalescing [2409.10743]. The 2.0 report again describes node data in Structure of Arrays (SoA) for coalesced GPU loads, with leaf pointers to value indices in a separate array [2507.23700]. A plausible implication is that the precise internal layout is an implementation detail that has evolved with hardware tuning and release objectives.

## 3. Interface evolution and generalized API in version 2.0

The 1.x interface was intentionally narrow. The technical report’s recap of API v1 shows a `BVH<MemorySpace>` class with a hardwired `bounding_volume_type = ArborX::Box`, a constructor from primitives, and a `query()` method returning only indices and offsets in CSR-style form [2507.23700]. Its listed limitations are explicit: hardwired to 3D AABBs, no execution-space argument leading to global fencing, returns only indices plus offsets, and no callbacks or user-data in leaves [2507.23700].

Version 2.0 replaces that design with a templated `BVH<MemorySpace, Value, IndexableGetter, BoundingVolume>` and an explicit execution-space argument on both construction and query [2507.23700]. The report identifies the key expansions as arbitrary `Value` types and a user-supplied `IndexableGetter` for any geometry, an enum of bounding volumes via template argument, explicit `ExecutionSpace` for overlap with other Kokkos kernels, and three overloads of `query()` for zero, one, or many outputs per match [2507.23700]. The class also exposes `size()`, `empty()`, and `bounds()` [2507.23700].

The architectural rationale is tightly tied to Kokkos. In version 2.0, all data lives in `Kokkos::View<>` containers parameterized by a `MemorySpace`, and both construction and query routines take a Kokkos execution space so that work can be dispatched on arbitrary GPU streams or CPU threads [2507.23700]. The same report states that vendor-tuned kernels for sorting and reductions use Thrust, rocThrust, and oneDPL [2507.23700]. The generalized interface is summarized by three design points that materially alter user integration: arbitrary user data types, flexible bounding volumes, and dimension up to 10 on both CPU and GPU [2507.23700].

This interface evolution also clarifies a recurring misunderstanding about ArborX output semantics. In 1.x, the library returned only materialized search results in CSR-style arrays [2507.23700]. In 2.0, callbacks are a first-class execution model, so result processing can happen in place during traversal and large temporary arrays need not be materialized at all [2507.23700].

## 4. Query modes, callbacks, and algorithmic expansion

Callbacks are the main semantic addition in ArborX 2.0. The technical report defines them as a mechanism that lets users run arbitrary code on each `(predicate, value)` match inside traversal [2507.23700]. It presents two forms. The “pure callback” variant executes user code for each match without stored output, while the “callback with output” variant requires `output_type` and uses an emitter to append user-defined outputs [2507.23700]. The stated purpose is to allow in-place processing of query results without materializing large temporary arrays [2507.23700]. Traversal can also terminate early when callbacks return a `Terminate` tag [2507.23700].

ArborX 2.0 is no longer restricted to a single search data structure. The report adds a brute-force index for cases where “for small $N$ or degenerate point clouds, a brute-force index is often competitive” [2507.23700]. Its internal organization is simple—values in a contiguous `Kokkos::View<Value*>` and a nested `Kokkos::parallel_for` over queries and data—and its complexity is given as trivial build $O(1)$ and query
$$
T_{\mathrm{bruteforce}}=\Theta(Q \cdot N)
$$
for $Q$ queries and $N$ primitives [2507.23700]. The same document contrasts this with BVH behavior as $O(N \log N)$ build and $O(Q \cdot \log N + \text{total\_hits})$ query [2507.23700].

The algorithmic envelope has also widened. The 2.0 release lists ray tracing predicates, density-based clustering (DBSCAN), EMST, and MLS interpolation among supported algorithms [2507.23700]. For ray tracing, geometry is represented as `Ray = (origin, direction)`, and predicates include `nearest(k)` for the first $k$ intersections, `intersect` for all intersections, and `ordered_intersect` for hits sorted by distance [2507.23700]. The report describes a traversal pipeline of ray–node AABB tests, leaf-level ray–geometry intersection for triangle, box, or sphere, and early termination or sorting buffers depending on predicate semantics [2507.23700].

For DBSCAN, the report gives the standard formulation with points $\{p_i\}$, parameters $\varepsilon$ and `minPts`, neighborhood
$$
N_\varepsilon(p)=\{q \mid \|p-q\| \le \varepsilon\},
$$
and core points determined by $|N_\varepsilon(p)| \ge \text{minPts}$ [2507.23700]. It lists two implementations—FDBSCAN for sparse data and FDBSCAN-DenseBox for high local density—and states that both use ArborX for $\varepsilon$-neighborhood queries in parallel [2507.23700]. EMST is described as a complete graph with weights $w_{ij}=\|p_i-p_j\|$ and Kruskal’s or Prim’s algorithm accelerated by nearest-neighbor search, while MLS interpolation uses nearest queries to define local windows for weighted least squares [2507.23700].

## 5. Distributed search and exascale DBSCAN workflows

Distributed search in ArborX 2.0 is organized through `ArborX::DistributedTree`, which wraps a local BVH together with a global BVH over local AABBs [2507.23700]. Each MPI rank builds a local $\mathrm{BVH}_i$ over its data, all ranks exchange local AABBs to build a coarse global $\mathrm{BVH}_0$, and each query is first routed through $\mathrm{BVH}_0$ to a subset of ranks before local refinement on the destination ranks [2507.23700]. The report gives per-query communication complexity as $O(\log P)$ messages plus volume proportional to the number of overlapping ranks, and local cost as $O(\log N_i + k_i)$ [2507.23700]. GPU-aware MPI support is explicitly part of the 2.0 design goals [2507.23700].

The exascale paper provides the most detailed distributed DBSCAN formulation. Within each MPI rank, all $N_r$ points are inserted into a local BVH, and boundary points are communicated in a halo of radius $\varepsilon$ to neighbors so that global connectivity is preserved [2409.10743]. The paper states that this ghost exchange costs $O(N_r^{2/3})$ messages in a regular domain decomposition and later summarizes MPI exchange as $O(N_r^{2/3})$ data volume in one neighbor-round [2409.10743]. On the GPU, the computation is split into two Kokkos kernels: core identification, which issues a range query with early termination once the count hits `minPts`, and cluster merging, which performs pairwise traversal over all $(i,j)$ with $\|x_i-x_j\| \le \varepsilon$ and atomically unions points in a disjoint-set structure whenever thread $i$ visits $j$ and $i$ is core [2409.10743]. Because only pairs with $i<j$ are processed, every edge is handled exactly once [2409.10743].

The complexity statement for this exascale DBSCAN is explicit. Build BVH is $O(N_r)$; the core phase is $O(N_r \log N_r)$ worst case but practically $O(N_r)$ with early stops; the merge phase is $O(E_r\,\alpha(N_r))$, where $E_r$ is the number of edges within $\varepsilon$ in rank $r$ and $\alpha(\cdot)$ is the inverse Ackermann function for Union-Find [2409.10743]. On cosmology data at late times, the paper reports $E_r \approx 5 \times N_r$ [2409.10743].

The same work ties these methods to concrete cosmology settings. Its benchmark setup uses Summit, with $256$ nodes and $6$ V100 GPUs per node, and a HACC gravity + hydro box of side $256\,\mathrm{Mpc}/h$ with $2 \times 1024^3$ particles, sampled per rank to $N_r \approx 37 \times 10^6$ dark-matter points [2409.10743]. The clustering radius is parameterized by
$$
\varepsilon = b\bigl(V/N\bigr)^{1/3},
\qquad
b=0.168,\;V=256^3,\;N=1024^3,
$$
giving $\varepsilon \approx 0.042$ [2409.10743]. The paper further reports that HACC runs $N=2304^3$ gravity-only on $256$ GPUs for $625$ long-range steps, invoking DBSCAN on each step, and that hydrodynamic runs with $2 \times 2304^3$ particles can perform substructure finding every step in situ [2409.10743].

A major practical consequence is the migration of halo and galaxy finding from offline post-processing to in-situ analysis. The exascale paper states that, without ArborX, HACC reserved DBSCAN for offline post-processing, leading to $100\,\mathrm{PB}$ of dumped particle data [2409.10743]. With ArborX, cluster catalogs and galaxy identifications, with `minPts=10` for stars, are produced on the fly at each major timestep with negligible disruption to the solver [2409.10743].

## 6. Performance characteristics and empirical evaluation

The 2019 evaluation establishes ArborX as competitive with CPU-only state-of-the-art libraries even before the exascale additions. In single-threaded comparisons on the Elseberg synthetic data sets, the paper reports ArborX build at approximately $1.5\times$ faster than nanoflann and on par with Boost.Geometry.Index for $n \to 10^7$ [1908.11807]. For $k$NN query throughput on filled cases, it reports ArborX as $5$–$10\times$ faster for $n=10^7$, with even higher gains on hollow cases [1908.11807]. For range queries, the paper gives $4$–$6\times$ higher throughput in the 2-pass mode, about another $2\times$ improvement for the 1-pass mode when the buffer estimate holds, and up to $20$–$30\times$ higher throughput for hollow cases dominated by empty queries [1908.11807]. In terms of spatial search rate, it reports roughly $200$ million boxes per second for filled cases and roughly $600$ million boxes per second for hollow cases [1908.11807]. On Summit, one V100 GPU is reported as $3$–$6\times$ faster than $42$ POWER9 cores at SMT4 for $n \ge 10^6$, with range and $k$NN queries achieving more than $1$ billion node-tests per second on V100 [1908.11807].

The exascale paper isolates a timeline of DBSCAN-specific performance improvements across ArborX releases. It attributes a $20\%$ time reduction and halved memory overhead to FDbscan with callbacks and early termination in v1.4; a $40\%$ traversal-cost reduction to Apetrei build plus rope-stackless traversal in v1.6–v1.7; a further $15\%$ speedup on clustered data to 64-bit Morton codes in v1.9; and another $25\%$ gain to pairwise stackless traversal in v1.10 [2409.10743]. Cumulatively, the paper reports per-rank DBSCAN runtime dropping from approximately $1.4\,\mathrm{s}$ to under $0.15\,\mathrm{s}$, a $\times 9.2$ speedup [2409.10743]. For full HACC workflows, it reports ArborX-GPU DBSCAN at $10$–$12\times$ speedup over OpenMP-CPU and an approximately $2\times$ end-to-end acceleration of the production code [2409.10743].

The 2.0 technical report complements those release-history numbers with representative build-and-query trends across architectures. For strong scaling on an NVIDIA A100 with $N=1\,\mathrm{M}$ primitives and $Q=0.1\,\mathrm{M}$ queries, it reports build time improving from $0.30\,\mathrm{s}$ on a $24$-core AVX2 CPU to $0.05\,\mathrm{s}$ on A100, a $6\times$ speedup, and intersect-query time improving from $0.10\,\mathrm{s}$ to $0.02\,\mathrm{s}$, a $5\times$ speedup [2507.23700]. For weak scaling in distributed mode with fixed per-rank $N=100\,\mathrm{K}$ and $Q=10\,\mathrm{K}$ over $1 \to 64$ MPI ranks, the report states that total time is approximately constant build plus $O(\log \text{ranks})$ query routing [2507.23700]. Its GPU breakdown for $N=500\,\mathrm{K}$ boxes and $Q=500\,\mathrm{K}$ points reports $15\,\mathrm{ms}$ for Morton sort, $8\,\mathrm{ms}$ for BVH build, $20\,\mathrm{ms}$ for spatial query, and $25\,\mathrm{ms}$ for ray tracing with $k=1$ [2507.23700]. The same report describes a log–log plot of query time versus $N$ whose slopes match the theoretical exponents for $O(N \log N)$ build and near-$O(Q \log N)$ query [2507.23700].

Taken together, these evaluations define ArborX as a portable HPC search substrate whose performance story is not limited to raw BVH traversal. The reported gains depend on a sequence of interlocking mechanisms: Kokkos-based back-end portability, 64-bit Morton codes, Apetrei-style build strategies, stackless or pairwise traversals, early-out callbacks, distributed routing through a two-level index, and algorithm-specific integrations such as DBSCAN and ray tracing [2409.10743] [2507.23700].

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