Table of Contents
Fetching ...

Parallel $k$d-tree with Batch Updates

Ziyang Men, Zheqi Shen, Yan Gu, Yihan Sun

TL;DR

The paper tackles the challenge of efficiently building and maintaining large-scale, multi-dimensional data with kd-trees in parallel. It introduces the Pkd-tree, a single, weight-balanced, dynamic parallel kd-tree that supports fast parallel construction, batch insertions/deletions, and efficient queries, backed by strong theoretical bounds on work, span, and cache complexity. The core contributions are a sampling-based multi-level construction with a cache-friendly sieving step, a lazy reconstruction-based update strategy, and extensive empirical validation showing dramatic improvements over state-of-the-art parallel kd-trees in construction and updates while delivering competitive query performance. This work significantly advances practical, high-performance in-memory multi-dimensional indexing, with broad applicability to large-scale data analytics and spatial querying, and it provides publicly available code for replication.

Abstract

The $k$d-tree is one of the most widely used data structures to manage multi-dimensional data. Due to the ever-growing data volume, it is imperative to consider parallelism in $k$d-trees. However, we observed challenges in existing parallel kd-tree implementations, for both constructions and updates. The goal of this paper is to develop efficient in-memory $k$d-trees by supporting high parallelism and cache-efficiency. We propose the Pkd-tree (Parallel $k$d-tree), a parallel $k$d-tree that is efficient both in theory and in practice. The Pkd-tree supports parallel tree construction, batch update (insertion and deletion), and various queries including k-nearest neighbor search, range query, and range count. We proved that our algorithms have strong theoretical bounds in work (sequential time complexity), span (parallelism), and cache complexity. Our key techniques include 1) an efficient construction algorithm that optimizes work, span, and cache complexity simultaneously, and 2) reconstruction-based update algorithms that guarantee the tree to be weight-balanced. With the new algorithmic insights and careful engineering effort, we achieved a highly optimized implementation of the Pkd-tree. We tested Pkd-tree with various synthetic and real-world datasets, including both uniform and highly skewed data. We compare the Pkd-tree with state-of-the-art parallel $k$d-tree implementations. In all tests, with better or competitive query performance, Pkd-tree is much faster in construction and updates consistently than all baselines. We released our code.

Parallel $k$d-tree with Batch Updates

TL;DR

The paper tackles the challenge of efficiently building and maintaining large-scale, multi-dimensional data with kd-trees in parallel. It introduces the Pkd-tree, a single, weight-balanced, dynamic parallel kd-tree that supports fast parallel construction, batch insertions/deletions, and efficient queries, backed by strong theoretical bounds on work, span, and cache complexity. The core contributions are a sampling-based multi-level construction with a cache-friendly sieving step, a lazy reconstruction-based update strategy, and extensive empirical validation showing dramatic improvements over state-of-the-art parallel kd-trees in construction and updates while delivering competitive query performance. This work significantly advances practical, high-performance in-memory multi-dimensional indexing, with broad applicability to large-scale data analytics and spatial querying, and it provides publicly available code for replication.

Abstract

The d-tree is one of the most widely used data structures to manage multi-dimensional data. Due to the ever-growing data volume, it is imperative to consider parallelism in d-trees. However, we observed challenges in existing parallel kd-tree implementations, for both constructions and updates. The goal of this paper is to develop efficient in-memory d-trees by supporting high parallelism and cache-efficiency. We propose the Pkd-tree (Parallel d-tree), a parallel d-tree that is efficient both in theory and in practice. The Pkd-tree supports parallel tree construction, batch update (insertion and deletion), and various queries including k-nearest neighbor search, range query, and range count. We proved that our algorithms have strong theoretical bounds in work (sequential time complexity), span (parallelism), and cache complexity. Our key techniques include 1) an efficient construction algorithm that optimizes work, span, and cache complexity simultaneously, and 2) reconstruction-based update algorithms that guarantee the tree to be weight-balanced. With the new algorithmic insights and careful engineering effort, we achieved a highly optimized implementation of the Pkd-tree. We tested Pkd-tree with various synthetic and real-world datasets, including both uniform and highly skewed data. We compare the Pkd-tree with state-of-the-art parallel d-tree implementations. In all tests, with better or competitive query performance, Pkd-tree is much faster in construction and updates consistently than all baselines. We released our code.

Paper Structure

This paper contains 29 sections, 7 theorems, 10 figures, 10 tables, 2 algorithms.

Key Result

Lemma 3.1

For a Pkd-tree$T$ with size $n'$, for any $\epsilon<1$, setting $\sigma\xspace=(6c\log n)/\epsilon^2$ guarantees that the size of a child subtree is within the range of $(1/2\pm \epsilon/4)\cdot n'$ with probability at least $1-2/n^c$.

Figures (10)

  • Figure 1: An illustration of our $k$d-tree construction algorithm, with a detailed overview on the sieving step. In this example, we first sample seven points and construct the tree skeleton using the samples, dividing the plane into four regions (buckets). Next, we sieve all points into the corresponding bucket. Concretely, we divide the points $P$ into chunks of size $l=3$. All chunks are processed in parallel. For each chunk, we count the number of points for every bucket in array $A$. We then compute the exclusive prefix sum of $A$ in column-major order to get the offset matrix $B$. We then move all points from $P$ to $P'$ so that points within each bucket are contiguous. Finally, we recursively construct each subtree (a bucket in $P'$) in parallel.
  • Figure 2: Illustation of our batch insertion to a $k$d-tree. Our algorithm first fetches the tree skeleton from the $k$d-tree, sieves the points into the corresponding bucket as in \ref{['algo:constr']}, then processes each buckets in parallel, and finally rebuilds the subtrees that become imbalance after insertion.
  • Figure 3: Time required for batch update on points from Varden and Uniform on a tree with 1000M points in 3 dimensions. Lower is better. The batch size is the number of points ($\times$ 1M) in the batch. The time is measured in seconds. Both axes are in log-scale.
  • Figure 4: Running time (in seconds) of $k$-NN queries for $k\in\{1,10,100\}$. Lower is better. The dataset contains 1000M points in 3 dimensions. The test contains $k$-NN queries from $10^7$ points in the input. Plots are in log-log scale.
  • Figure 5: Running time (in seconds) of range queries w.r.t. output sizes. Lower is better. The dataset contains 1000M points in 3 dimensions. Plots are in log-log scale.
  • ...and 5 more figures

Theorems & Definitions (7)

  • Lemma 3.1
  • Lemma 3.2: Tree height
  • Theorem 3.3: Construction cost
  • Theorem 3.4: Improved span
  • Theorem 4.1: Updates
  • Lemma A.1
  • Theorem B.1: Updates