oxigdal-gpu
GPU-accelerated geospatial operations for OxiGDAL using wgpu — cross-platform, pure Rust GPU compute. Part of the OxiGDAL ecosystem.
Features
- Cross-platform: Vulkan, Metal, DX12, WebGPU — one API for all platforms
- Element-wise operations: Add, subtract, multiply, divide, power, clamp
- Statistical operations: Parallel reduction, histogram (256/1024 bins), min/max, mean, std-dev
- Resampling: Nearest neighbor, bilinear, bicubic interpolation on GPU
- Convolution: Gaussian blur, edge detection (Sobel), Laplacian, custom kernel
- Raster algebra: Pixel-wise band math expressions on GPU
- Pipeline API: Chain operations without CPU round-trips (zero intermediate copies)
- Async execution: Non-blocking GPU dispatch, works with Tokio
- Pure Rust: No CUDA/OpenCL/C bindings — wgpu only
Installation
[]
= "0.1.3"
Enable WebGPU on WASM targets:
[]
= { = "0.1.3", = ["webgpu"] }
Quick Start
use ;
async
Operations
Element-wise
let pipeline = from_data?
.add_scalar?
.multiply?
.power?
.clamp?;
Multi-band Raster Algebra (NDVI)
use BandAlgebra;
let ndvi = new
.with_band?
.with_band?
.expression?
.execute?;
Convolution
let blurred = pipeline.gaussian_blur?; // Gaussian sigma=3.0
let edges = pipeline.sobel_edge?; // Sobel edge detection
let laplacian = pipeline.laplacian?; // Laplacian sharpening
let custom = pipeline.convolve?; // 3x3 custom kernel
Statistics (parallel GPU reduction)
use GpuStats;
let stats = compute.await?;
println!;
let hist = histogram.await?;
Resampling
use ;
let resampler = new?;
let downsampled = resampler.resample.await?;
Performance
Benchmarks on NVIDIA RTX 4080 vs CPU (Apple M2, single thread):
| Operation (4096x4096 f32) | CPU | GPU | Speedup |
|---|---|---|---|
| Element-wise multiply | 120 ms | 1.2 ms | 100x |
| Gaussian blur (sigma=3) | 580 ms | 5.5 ms | 105x |
| Bilinear resampling | 230 ms | 9 ms | 25x |
| Histogram (256 bins) | 180 ms | 2 ms | 90x |
| Pipeline (3 ops, no copies) | 900 ms | 9 ms | 100x |
Significant speedup for large rasters (>= 2048x2048). For small rasters, CPU overhead dominates.
Requirements
- Rust 1.85+
- GPU with Vulkan 1.0+ (Linux/Windows), Metal (macOS), or DX12 (Windows)
- WebGPU (optional WASM target)
Advanced: oxigdal-gpu-advanced
For complex compute shaders, custom WGSL kernels, and multi-GPU workflows,
see oxigdal-gpu-advanced.
COOLJAPAN Policies
- Pure Rust — wgpu only, no CUDA/OpenCL/C bindings in default features
- No
unwrap()— all GPU errors handled viaResult<T, GpuError> - Workspace dependencies via
*.workspace = true
License
Apache-2.0 — Copyright (c) COOLJAPAN OU (Team Kitasan)