FluidGeo H3-Turbo
FluidGeo H3-Turbo is a hardware-accelerated H3 spatial indexing library powered by SYCL (AdaptiveCpp). It provides high-performance, drop-in GPU/CPU-parallelized replacements for standard H3 operations, designed to operate seamlessly on NumPy arrays and PySpark DataFrames.
Quick Links & Resources
- PyPI Project Page: View releases, installation requirements, and package details.
- h3_turbo_benchmarks.ipynb: An interactive Jupyter notebook comparing GPU-accelerated operations against CPU-based
h3-pyandnumpyequivalents across various data sizes (raw compute, spatial joins, batch processing, and GPU index caching reuse). - spark_udf_tests.ipynb: Interactive Jupyter notebook demonstrating PySpark integration, UDF usage, and persistent spatial join optimizations.
Licensing
FluidGeo H3-Turbo is offered under a dual-license model:
- Academic & Non-Commercial: Free for research and educational purposes.
- Commercial & Enterprise: A yearly subscription is required for production environments.
- Features: Up to ~1000x speedup on Blackwell/Hopper GPUs, zero-copy pinned memory, multi-GPU scalability, and priority SYCL kernel support.
For enterprise trial keys, support, and pricing, contact: info@fluidgeollc.com
Installation
H3-Turbo is available on PyPI and comes with pre-compiled "fat" wheels for Linux (CUDA 12.x) supporting NVIDIA Ampere, Ada Lovelace, Hopper, and Blackwell architectures.
pip install h3-turbo
Hardware Initialization & Verification
Before executing large workloads, verify that your SYCL acceleration backend is correctly recognized and warm up the JIT compiler.
import h3_turbo
# 1. Check version (consistent with pyproject.toml)
print(f"H3 Turbo Version: {getattr(h3_turbo, '__version__', 'unknown')}")
# 2. Query active SYCL device
device = h3_turbo.device_name() # or h3_turbo.get_device_name()
print(f"Active Compute Device: {device}")
# 3. Warm up JIT compiler
h3_turbo.warmup()
print("JIT compilation warmed up and ready!")
Python API Reference
H3-Turbo functions are optimized for high-throughput batch operations on NumPy arrays.
1. Lat/Lon to Cell Conversion
Convert coordinates (lats, lons) to H3 cell indexes at a specific resolution.
import numpy as np
lats = np.random.uniform(37.7, 37.8, 1_000_000)
lngs = np.random.uniform(-122.5, -122.4, 1_000_000)
resolution = 9
# Returns a uint64 array of H3 indices
cells = h3_turbo.latlng_to_cell(lats, lngs, resolution)
2. Cell to Parent
Find the parent cells at a coarser resolution.
parent_res = 5
parents = h3_turbo.cell_to_parent(cells, parent_res)
3. Grid Disk (k-ring)
Compute the grid disk of radius k around cell(s). Supports both scalar origins and batch arrays.
# Scalar origin: returns 1D array of cells
single_disk = h3_turbo.grid_disk(0x8928308280fffff, k=2)
# Batch array: returns a 2D (N, max_k_size) array padded with 0s
disks = h3_turbo.grid_disk(cells, k=2)
4. Cell to Boundary
Get the lat/lng boundary coordinates of cells.
# Returns an (N, 7, 2) array of [lat, lng] boundary vertices
boundaries = h3_turbo.cell_to_boundary(cells)
# Unoptimized 10-vertex boundary layout (for specific legacy compatibility)
boundaries_10 = h3_turbo.cell_to_boundary_10(cells)
5. Spatial Join (Point-in-Polygon / Inclusion Check)
Check if points (pings) are within a set of zones.
- Production Overload: Strictly 3 parameters, running at maximum GPU performance (no scramble).
- Benchmarking Overload: Includes the optional
scramble_iterationsparameter (e.g., set to50for matching baseline/benchmark scrambles).
zones = np.array([0x8928308280fffff], dtype=np.uint64)
# 1. Production usage (no scramble_iterations needed)
mask = h3_turbo.spatial_join(cells, zones, resolution=9)
# 2. Benchmarking / verification usage
mask_bench = h3_turbo.spatial_join(cells, zones, resolution=9, scramble_iterations=50)
6. Persistent Joiner (Advanced Spatial Join)
For high-frequency point-in-polygon queries, avoid rebuilding the spatial index on every call by reusing a persistent instance. Use this when running many spatial join queries on the same set of zones.
# 1. Production usage (no scramble_iterations needed)
joiner = h3_turbo.PersistentJoiner(zones, resolution=9)
# 2. Benchmarking / verification usage
joiner_bench = h3_turbo.PersistentJoiner(zones, resolution=9, scramble_iterations=50)
# Run multiple joins efficiently
results = np.zeros(len(cells), dtype=np.uint8)
joiner.join(cells, results)
7. Batch Transform
In-place GPU resolution transformation of an array of H3 indices.
cells_to_transform = cells.copy()
# 1. Production usage (no scramble_iterations needed)
h3_turbo.batch_transform(cells_to_transform, res=8)
# 2. Benchmarking / verification usage
h3_turbo.batch_transform(cells_to_transform, res=8, scramble_iterations=50)
8. System Control & Cleanup
# Set your enterprise license key to unlock full performance
h3_turbo.set_license_key("YOUR_LICENSE_KEY")
# Manually release internal GPU queue and SYCL resources
h3_turbo.cleanup()
Spark / Databricks Integration
H3-Turbo provides high-throughput Pandas UDFs for PySpark, enabling distributed GPU execution.
import os
import sys
from pyspark.sql import SparkSession
from pyspark.sql.functions import col
# Ensure workers run in the environment containing pyarrow and h3_turbo
os.environ["PYSPARK_PYTHON"] = sys.executable
os.environ["PYSPARK_DRIVER_PYTHON"] = sys.executable
from spark_h3_turbo import (
latlng_to_cell_udf,
cell_to_parent_udf,
grid_disk_udf,
spatial_join_udf,
persistent_spatial_join_udf,
batch_transform_udf
)
spark = SparkSession.builder.appName("H3-Turbo-Spark").getOrCreate()
# 1. Lat/Lon to Cell
df = df.withColumn("h3", latlng_to_cell_udf(resolution=9)(col("lat"), col("lon")))
# 2. Cell to Parent
df = df.withColumn("parent", cell_to_parent_udf(parent_res=5)(col("h3")))
# 3. Grid Disk
df = df.withColumn("kring", grid_disk_udf(k=2)(col("h3")))
# 4. Spatial Join (Broadcast / Inclusion Check)
# Use spatial_join_udf for simple one-off queries
zones_list = [0x8928308280fffff]
df = df.withColumn("in_zone", spatial_join_udf(zones_list, res=9)(col("h3")))
# Use persistent_spatial_join_udf for large datasets. It caches the GPU spatial
# index once per PySpark worker process and reuses it across all partition batches,
# preventing index rebuild overhead.
df = df.withColumn("in_zone_persistent", persistent_spatial_join_udf(zones_list, res=9)(col("h3")))
# 5. Batch Transform
df = df.withColumn("transformed_h3", batch_transform_udf(res=8)(col("h3")))
Release files for h3-turbo 0.1.14
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| h3_turbo-0.1.14.tar.gz | 21.4 kB | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| h3_turbo-0.1.14-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl | CPython 3.14 | CPython 3.14 | Linux glibc 2.27+ x86-64, Linux glibc 2.28+ x86-64 | Details |
| h3_turbo-0.1.14-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl | CPython 3.13 | CPython 3.13 | Linux glibc 2.27+ x86-64, Linux glibc 2.28+ x86-64 | Details |
| h3_turbo-0.1.14-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl | CPython 3.12 | CPython 3.12 | Linux glibc 2.27+ x86-64, Linux glibc 2.28+ x86-64 | Details |
| h3_turbo-0.1.14-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl | CPython 3.11 | CPython 3.11 | Linux glibc 2.28+ x86-64, Linux glibc 2.27+ x86-64 | Details |
Total release size: 208.3 MB
Release files / h3_turbo-0.1.14.tar.gz
| Download URL | h3_turbo-0.1.14.tar.gz |
|---|---|
| Size | 21.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e27865fde877dde27d300c06b237ded63429450e1ae36071211c908bd68ccf6c
|
|
BLAKE2b-256 checksum How to use checksums |
ba5e0aabfb40f908ca3e4d00366a8ad0ecaacd9e9624a2aa2c88682dff0777d7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / h3_turbo-0.1.14-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
| Download URL | h3_turbo-0.1.14-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 52.1 MB |
| Tags | CPython 3.14 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
de6d109b38dad25142d98fd106676e2a4f9c153329db1b450ac0cce0f2aa1a27
|
|
BLAKE2b-256 checksum How to use checksums |
70ea4caee0ff49f9a518f8f9eca5f9ddd2274590fd884b6fdf7582df0ccfcec8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / h3_turbo-0.1.14-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
| Download URL | h3_turbo-0.1.14-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 52.1 MB |
| Tags | CPython 3.13 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
454d3dad00c87982b03b1ca7aec790c6c466097ad4b2ba7f401b7bb7333ce3a1
|
|
BLAKE2b-256 checksum How to use checksums |
935e325bbafcc988fb7b6d5a75a40e3732eda6b201f030fe923b754666894d54
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / h3_turbo-0.1.14-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
| Download URL | h3_turbo-0.1.14-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 52.1 MB |
| Tags | CPython 3.12 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
c7129a5b6e838286274147b4cb305bb2e07a31c78381b333c3e6dafc8cf3d2e6
|
|
BLAKE2b-256 checksum How to use checksums |
ab2d8a7b8cd0ee5f05d9ed87ca1fc9266c4f109295f6ef2161f4e44eb4e4233b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / h3_turbo-0.1.14-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
| Download URL | h3_turbo-0.1.14-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 52.1 MB |
| Tags | CPython 3.11 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
f0bd3fa19d0af36dc3c66712a550e1055125d0e04f0643bc873d2ece1b73367c
|
|
BLAKE2b-256 checksum How to use checksums |
1016d58c73a79a83afc4b2bf8255a2bbe6bcdc635346d90ff73c19a33943d909
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|