Skip to content

Fixes #906: fill remaining dask+cupy gaps (terrain, perlin, crosstab)#913

Merged
brendancol merged 4 commits intomasterfrom
fill-dask-cupy-gaps-906
Feb 27, 2026
Merged

Fixes #906: fill remaining dask+cupy gaps (terrain, perlin, crosstab)#913
brendancol merged 4 commits intomasterfrom
fill-dask-cupy-gaps-906

Conversation

@brendancol
Copy link
Contributor

Summary

  • Add dask+cupy backend for perlin() — launches _perlin_gpu kernel per chunk with coordinate ranges computed from block_info
  • Add dask+cupy backend for generate_terrain() — same per-chunk GPU kernel approach across 16 noise layers
  • Add cupy and dask+cupy backends for crosstab() — converts to numpy/dask+numpy and delegates (output is a DataFrame, no GPU advantage in aggregation)
  • Fix _find_cats() to handle pure cupy arrays without wrapping in @delayed

Closes #906

Test plan

  • New GPU tests in test_dask_cupy_gaps.py: perlin dask+cupy, terrain dask+cupy, crosstab cupy, crosstab dask+cupy
  • All existing perlin, terrain, and zonal tests pass (112 tests)

Add missing dask+cupy backends for perlin() and generate_terrain()
using per-chunk GPU kernel launches via da.map_blocks with block_info
coordinate mapping. Add cupy and dask+cupy backends for crosstab()
by converting to numpy/dask+numpy and delegating. Fix _find_cats()
to handle pure cupy arrays without wrapping in @delayed.
- Terrain Generation, Perlin Noise: mark dask+cupy as ✅ (native)
- Zonal Cross Tabulate: mark cupy and dask+cupy as 🔄 (CPU fallback)
- Zonal Statistics: mark cupy as ✅ (native), dask+cupy as 🔄 (fallback)
- Apply: mark cupy and dask+cupy as 🔄 (CPU fallback)
Both functions only need numpy for the boundary scan; the output is a
slice of the original DataArray, so the backend is preserved. Convert
to numpy for the scan, then slice the original raster.

Update README feature matrix for trim and crop.
JIT-compile the user's scalar function as a CUDA device function and
run it inside a CUDA kernel, avoiding the GPU→CPU→GPU round-trip.
Non-compilable functions (e.g. using dict, str) automatically fall
back to the existing CPU path via exception handling.
@brendancol brendancol merged commit 52f9fb5 into master Feb 27, 2026
9 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fill remaining dask+cupy gaps: terrain, perlin, and zonal.crosstab

1 participant