Skip to content

Cover the dask+cupy combined read backend (#1543)#1545

Open
brendancol wants to merge 1 commit intomainfrom
coverage/dask-cupy-combined-backend-1536
Open

Cover the dask+cupy combined read backend (#1543)#1545
brendancol wants to merge 1 commit intomainfrom
coverage/dask-cupy-combined-backend-1536

Conversation

@brendancol
Copy link
Copy Markdown
Contributor

Closes #1543.

Summary

  • open_geotiff(gpu=True, chunks=N) and read_geotiff_gpu(chunks=N) advertise an "out-of-core GPU" path in their docstrings but had zero tests
  • Adds xrspatial/geotiff/tests/test_dask_cupy_combined.py with five round-trip tests that pin the contract (Dask wrapper, CuPy _meta, requested chunk shape, post-compute device memory, pixel equality with eager numpy read, geo-attr preservation)
  • Tests skip cleanly when CuPy or CUDA is unavailable; verified passing locally on a CUDA host

Test plan

  • python -m pytest xrspatial/geotiff/tests/test_dask_cupy_combined.py -v -- 5 passed
  • python -m pytest xrspatial/geotiff/tests/ -q (excluding pre-existing unrelated TestPalette matplotlib/Python 3.14 deepcopy failures) -- 941 passed

`open_geotiff(gpu=True, chunks=N)` and `read_geotiff_gpu(chunks=N)` had
no tests despite both docstrings advertising them as the
"out-of-core GPU" path. The chunk-wrap step that produces a Dask array
with a CuPy `_meta` was unverified, so a refactor that swapped the
meta to NumPy or dropped the chunk call would not have failed any
existing test.

Five tests cover:
- single-band int chunks
- read_geotiff_gpu with tuple chunks
- 3-band tiled raster
- partial last chunk (image not divisible by chunks)
- CRS / transform / coord preservation

Tests skip cleanly when CuPy or CUDA are unavailable.
@github-actions github-actions Bot added the performance PR touches performance-sensitive code label May 10, 2026
@brendancol brendancol requested a review from Copilot May 10, 2026 02:14
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds test coverage for the “Dask+CuPy combined” GeoTIFF read path (open_geotiff(..., gpu=True, chunks=...) / read_geotiff_gpu(..., chunks=...)) to prevent silent regressions in the lazy-on-GPU contract described in the docstrings.

Changes:

  • Introduces a new GPU-only pytest module with round-trip tests validating Dask wrapping, CuPy _meta, chunk shapes, device-backed compute results, and pixel/geo-attr parity vs eager CPU reads.
  • Updates the internal .claude sweep tracking CSV to record inspection status for the geotiff test-coverage gap.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
xrspatial/geotiff/tests/test_dask_cupy_combined.py New GPU-only test module covering the combined Dask+CuPy read backend behavior and invariants.
.claude/sweep-test-coverage-state.csv Updates coverage sweep tracking state to reflect addressing issue #1543.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +24 to +25
import os
import tempfile
Comment on lines +77 to +82
# After compute the result is still a cupy array, not numpy.
computed = da_arr.compute()
assert isinstance(computed.data, cupy.ndarray), (
f"compute() returned {type(computed.data).__name__} "
"(should stay on device)"
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

performance PR touches performance-sensitive code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Test gap: dask+cupy combined read backend has no test coverage

2 participants