Skip to main content

Parallel compressed cover tree (PCCT) library targeting JAX-based Vecchia GP workloads.

Project description

Covertreex

A high-performance parallel compressed cover tree (PCCT) library optimized for Vecchia-style Gaussian process pipelines.

PyPI version License

Features

  • Hybrid Python/Numba + Rust implementation for maximum performance
  • ~170x faster than GPBoost for residual correlation k-NN queries
  • AVX2 SIMD optimized dot products in the Rust backend
  • Hilbert curve ordering for cache-efficient tree construction
  • Residual correlation metric with RBF and Matérn 5/2 kernels
  • Batch insert with parallel MIS-based conflict resolution

Performance

Benchmark on AMD Ryzen 9 9950X (N=32k points, D=3, k=50 neighbors):

Engine Build Time Query Throughput vs GPBoost
python-numba 7.2s 42,000 q/s 154x faster
rust-hilbert 0.85s 47,000 q/s 170x faster

Installation

pip install covertreex

For development with Rust backend:

pip install -e ".[dev]"
maturin develop --release

Quick Start

from covertreex.api import PCCT, Runtime

# Configure runtime
runtime = Runtime(metric="euclidean", enable_numba=True)

# Build tree and query
with runtime.activate() as ctx:
    tree = PCCT(runtime).fit(points)
    indices, distances = tree.knn(queries, k=10, return_distances=True)

Residual Correlation Metric

For Gaussian process applications with Vecchia approximations:

from covertreex.api import PCCT, Runtime, Residual

# Configure residual metric
residual = Residual(
    v_matrix=V,           # Inducing point matrix
    p_diag=p_diag,        # Diagonal of precision matrix
    coords=coordinates,   # Spatial coordinates
    kernel_type=0,        # 0=RBF, 1=Matérn 5/2
)

runtime = Runtime(metric="residual", residual=residual)
with runtime.activate() as ctx:
    tree = PCCT(runtime).fit(points)
    neighbors, distances = tree.knn(queries, k=50, return_distances=True)

CLI Usage

# List available profiles
python -m cli.pcct profile list

# Run k-NN benchmark
python -m cli.pcct query --dimension 8 --tree-points 8192 --queries 512 --k 8

# Run residual benchmark with Rust engine
python -m cli.pcct query --metric residual --engine rust-hilbert \
    --tree-points 32768 --dimension 3 --queries 1024 --k 50

# Environment/dependency check
python -m cli.pcct doctor --profile default

Execution Engines

Engine Description Use Case
python-numba Reference implementation with full telemetry Debugging, validation
rust-natural Rust backend, natural point order General use
rust-hilbert Rust backend, Hilbert curve order Production (fastest)

The Rust backend is enabled by default. Disable with COVERTREEX_ENABLE_RUST=0.

Benchmark Suite

# Gold standard residual benchmark (N=32k, D=3)
./benchmarks/run_residual_gold_standard.sh

# Comprehensive Rust vs Python comparison
python benchmarks/comprehensive_residual_benchmark.py

# CI reference benchmarks
python tools/run_reference_benchmarks.py

Documentation

License

Apache 2.0 — See LICENSE for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

covertreex-0.1.0-cp313-cp313-manylinux_2_34_x86_64.whl (780.2 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.34+ x86-64

File details

Details for the file covertreex-0.1.0-cp313-cp313-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for covertreex-0.1.0-cp313-cp313-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 e289bb0698329b9e2ecc1b1d8bc16a75cb150b8717d115faa155e2da046de6a0
MD5 ec48f4e387f7f476896ad416eca58777
BLAKE2b-256 c17d9fd228282761223d8dc4a525c163a13baf0beb2b06bf9ad2b387d3755284

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page