Add GPU and edge-case test coverage for spline()#2927
Merged
brendancol merged 1 commit intoJun 4, 2026
Conversation
TestSpline only exercised numpy and dask+numpy. The cupy and dask+cupy paths (including the _tps_cuda_kernel CUDA kernel) ran with no tests, unlike kriging which has full GPU parity coverage. Adds, all test-only: - test_cupy_matches_numpy, test_dask_cupy_matches_numpy (GPU parity, guarded with cuda_and_cupy_available / dask_array_available) - test_two_point_affine_fit covering the n==2 least-squares branch in _tps_build_and_solve - test_output_metadata asserting coords/dims/attrs/name preservation Verified all four spline backends green on a CUDA host (45 passed). deep-sweep test-coverage (scope=spline-only); GH issue creation was denied by the auto-mode classifier, so no issue is linked.
brendancol
commented
Jun 4, 2026
Contributor
Author
brendancol
left a comment
There was a problem hiding this comment.
PR Review: Add GPU and edge-case test coverage for spline()
Test-only PR. No source changes, so the checks below apply to the tests, not to new production code.
Blockers
None.
Suggestions
None.
Nits
- test_cupy_matches_numpy and test_dask_cupy_matches_numpy both use a 3x3 square grid. A non-square grid (e.g. 2x3) would exercise the kernel's row/col indexing harder, but the existing kriging GPU tests in this file use square grids too, so matching the convention is fine.
What looks good
- Both GPU tests reuse the existing cuda_and_cupy_available / dask_array_available decorators and the _to_numpy helper, matching the kriging tests in the same file.
- test_two_point_affine_fit pins the n==2 affine-fit branch with a hand-checkable oracle: (0,0)->10 and (2,0)->20 give a pure x-gradient, so x=1 reads 15 and x=2 reads 20.
- test_output_metadata checks coords, dims, attrs, and name. It goes one step past the IDW metadata test by also asserting attrs equality.
- The dask_cupy test uses chunks=(2,2) on a 3x3 grid, so it covers ragged (2,1) chunk boundaries.
Checklist
- All four spline backends covered now (numpy, cupy, dask+numpy, dask+cupy): yes
- GPU tests guarded with skip decorators: yes
- Edge cases (n==2 branch, metadata) covered: yes
- Reference values hand-checked, not just "runs without crashing": yes
- Temp files uniquely named: n/a, none
- Docstrings on tests: present
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.
What
Test-only PR from a scoped test-coverage sweep on the spline interpolator. No source changes.
spline()registers four backends throughArrayTypeFunctionMapping, but TestSpline only exercised numpy and dask+numpy. The cupy and dask+cupy paths, including the_tps_cuda_kernelCUDA kernel, had no test coverage. Kriging already has GPU parity tests; spline did not.Changes
test_cupy_matches_numpyandtest_dask_cupy_matches_numpyon TestSpline, guarded with the existingcuda_and_cupy_available/dask_array_availabledecorators.test_two_point_affine_fitcovering then == 2least-squares affine branch in_tps_build_and_solve.test_output_metadataasserting the output keeps the template's coords, dims, attrs, and name.Backend coverage
numpy, cupy, dask+numpy, dask+cupy all exercised for spline now.
Test plan
pytest xrspatial/tests/test_interpolation.py::TestSpline-- 9 passed on a CUDA host (both GPU parity tests ran, not skipped)pytest xrspatial/tests/test_interpolation.py-- 45 passedNo GH issue is linked: issue creation was blocked by the local auto-mode classifier during this run.