Skip to content

Add GPU backend test coverage for idw()#2925

Merged
brendancol merged 2 commits into
xarray-contrib:mainfrom
brendancol:deep-sweep-test-coverage-idw-2026-06-04
Jun 5, 2026
Merged

Add GPU backend test coverage for idw()#2925
brendancol merged 2 commits into
xarray-contrib:mainfrom
brendancol:deep-sweep-test-coverage-idw-2026-06-04

Conversation

@brendancol
Copy link
Copy Markdown
Contributor

Closes #2919

idw() registers four backends (numpy, cupy, dask+numpy, dask+cupy) but the test suite only exercised numpy and dask+numpy. The cupy and dask+cupy paths were never run by any test, unlike kriging in the same file which already has GPU coverage. This adds the missing tests so a GPU-only regression in _idw_cuda_kernel or the cupy/dask+cupy wrappers gets caught.

Test-only change. No source files were modified.

New tests in TestIDW:

  • test_cupy_matches_numpy, test_cupy_exact_interpolation
  • test_dask_cupy_matches_numpy
  • test_cupy_knearest_rejected, test_dask_cupy_knearest_rejected

Backend coverage: numpy and dask+numpy were already covered; this PR adds cupy and dask+cupy.

Test plan:

  • pytest xrspatial/tests/test_interpolation.py -> 46 passed on a CUDA host
  • New GPU tests confirmed running (not skipped) and the cupy template returns a cupy-backed result

@github-actions github-actions Bot added the performance PR touches performance-sensitive code label Jun 4, 2026
Copy link
Copy Markdown
Contributor Author

@brendancol brendancol left a comment

Choose a reason for hiding this comment

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

PR Review: Add GPU backend test coverage for idw()

Test-only change adding cupy and dask+cupy coverage for idw(). I confirmed all 6 new tests run (not skipped) and pass on a CUDA host, and that a cupy template routes through _idw_cupy (the result comes back cupy-backed).

Blockers

None.

Suggestions

None.

Nits

None.

What looks good

  • The new tests follow the existing kriging GPU coverage in the same file and reuse the _to_numpy helper and the @cuda_and_cupy_available / @dask_array_available decorators.
  • Both the equivalence path and the k-nearest rejection path of the GPU wrappers are now covered.
  • test_dask_cupy_knearest_rejected raises eagerly at graph construction, so it does not call .compute().
  • Source is untouched, which matches the test-coverage sweep contract.

Checklist

  • All implemented backends produce consistent results (cupy / dask+cupy now asserted equal to numpy)
  • Edge cases covered (exact-match interpolation on GPU; GPU k rejection)
  • Dask chunk boundaries handled (2x2 chunks, all-points path)
  • No premature materialization
  • No README / docstring changes needed (test-only)

Add cupy and dask+cupy tests to TestIDW: all-points equivalence vs
numpy, cupy exact-interpolation, and the GPU k-nearest rejection paths.
Closes the backend-coverage gap where _idw_cupy / _idw_dask_cupy were
registered in the dispatch table but never exercised by any test.
@brendancol brendancol force-pushed the deep-sweep-test-coverage-idw-2026-06-04 branch from 1b06a5f to 6065316 Compare June 5, 2026 01:22
@brendancol brendancol merged commit 6900624 into xarray-contrib:main Jun 5, 2026
7 checks passed
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.

idw(): GPU backends (cupy, dask+cupy) have no test coverage

1 participant