aspect: keep lat/lon chunked in dask+cupy geodesic path (#2688)#2707
Open
brendancol wants to merge 4 commits into
Open
aspect: keep lat/lon chunked in dask+cupy geodesic path (#2688)#2707brendancol wants to merge 4 commits into
brendancol wants to merge 4 commits into
Conversation
The geodesic dask+cupy backend converted the full lat/lon broadcast views to cupy with cupy.asarray up front, densifying the whole (H, W) grid onto a single GPU at graph-construction time. Peak GPU memory scaled with the full array instead of the chunk size, so large rasters would OOM on the GPU. Build the lat/lon dask arrays from the numpy broadcast views and convert each block to cupy lazily via map_blocks, so only one chunk lands on the GPU at a time. The dask+numpy path already did the right thing. Add a graph-construction test (no compute) asserting the full lat/lon grids are not materialized on the GPU when the graph is built.
…e-aspect-2026-05-29
…e-aspect-2026-05-29
Add a one-line note that the module-level cupy reference in _to_cupy_f64 is always the real cupy module, since the helper is only reached from the dask+cupy backend. Addresses a review nit on PR #2707.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #2688
The geodesic dask+cupy
aspect()path converted the full lat/lon broadcast views to cupy withcupy.asarray()at graph-construction time, densifying the whole (H, W) grid onto a single GPU before chunking. Peak GPU memory scaled with the full array, so large rasters would OOM on the GPU.map_blocks, so only one chunk lands on the GPU at a time.Backend coverage: only the dask+cupy geodesic path changed. numpy, cupy, dask+numpy, and all planar paths are untouched.
Test plan:
xrspatial/tests/test_geodesic_aspect.pypasses (including dask+cupy correctness vs numpy)xrspatial/tests/test_aspect.pypasses