pwrliang opened a new pull request, #310:
URL: https://github.com/apache/sedona-db/pull/310
This PR adds GPU-accelerated spatial join support to SedonaDB using NVIDIA
CUDA and the libgpuspatial library. GPU execution is automatically enabled when
available and provides significant performance improvements for large-scale
spatial joins.
**Core Features**
- **GPU Spatial Join Execution**: Implemented `GpuSpatialJoinExec`
physical plan that leverages CUDA for parallel spatial join operations
- **Auto-detection**: GPU is automatically detected and enabled when
building with `--features gpu`
- **Optimizer Integration**: Spatial join optimizer automatically routes
queries to GPU when enabled and hardware is available
- **CPU Fallback**: Gracefully falls back to CPU execution when GPU is
unavailable or encounters errors
**Testing**
- Added SQL integration test `test_gpu_spatial_join_sql` with
guaranteed-intersecting geometries
- Test validates both ST_Intersects and ST_Contains predicates via SQL
EXPLAIN and execution
- Fixed optimizer schema validation to work correctly with GPU execution
plans
**Configuration**
- GPU can be enabled via: Build with `--features gpu` (auto-enables when
hardware detected)
```
# Disable GPU for entire session
ctx.sql("SET sedona.spatial_join.gpu.enable = false")
# Enable GPU for entire session
ctx.sql("SET sedona.spatial_join.gpu.enable = true")
# Check current setting
result = ctx.sql("SHOW sedona.spatial_join.gpu.enable")
result.show()
# Method 4: Set other GPU options
ctx.sql("SET sedona.spatial_join.gpu.min_rows_threshold = 100000")
ctx.sql("SET sedona.spatial_join.gpu.device_id = 0")
ctx.sql("SET sedona.spatial_join.gpu.fallback_to_cpu = true")
```
**Testing**
```bash
# Run GPU spatial join tests (requires CUDA-capable GPU)
cargo test --package sedona-spatial-join --features gpu
test_gpu_spatial_join_sql -- --nocapture --ignored
# Build CLI with GPU support
cargo build --bin sedona-cli --features gpu --release
# Verify GPU execution via EXPLAIN
./target/release/sedona-cli -c "EXPLAIN SELECT * FROM polygons JOIN points
ON ST_Intersects(polygons.geom, points.geom)"
# Should show: GpuSpatialJoinExec
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]