-
Notifications
You must be signed in to change notification settings - Fork 85
Open
Labels
backend-coverageAdding missing dask/cupy/dask+cupy backend supportAdding missing dask/cupy/dask+cupy backend supportenhancementNew feature or requestNew feature or requestgpuCuPy / CUDA GPU supportCuPy / CUDA GPU supportzonal tools
Description
Problem
zonal.stats() supports numpy, dask+numpy, and cupy, but not dask+cupy. Line 687 shows:
dask_cupy_func=lambda *args: not_implemented_func(
*args, messages='stats() does not support dask with cupy backed DataArray'
),The cupy backend (_stats_cupy at line 370) already works for single-GPU arrays. The gap is only dask+cupy — the multi-GPU / larger-than-VRAM case.
Proposed Fix
Implement _stats_dask_cupy() by adapting the existing _stats_dask_numpy() approach:
- Use
dask.delayedto process each(zones_block, values_block)pair with the existing cupy sort-and-stride logic from_stats_cupy. - Aggregate block-level results on the host (same pattern as the dask+numpy path).
- The existing cupy function handles sorting and unique-finding on GPU; the dask wrapper just orchestrates blocks.
Impact
Zonal statistics is a core GIS operation and arguably the most commonly used analytical function in the library. Users with multi-GPU setups or rasters larger than GPU VRAM need dask+cupy support.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
backend-coverageAdding missing dask/cupy/dask+cupy backend supportAdding missing dask/cupy/dask+cupy backend supportenhancementNew feature or requestNew feature or requestgpuCuPy / CUDA GPU supportCuPy / CUDA GPU supportzonal tools