Skip to content

Fix CuPy benchmark availability guard - #3758

Draft
aelde wants to merge 1 commit into
xarray-contrib:mainfrom
aelde:fix-3707-cupy-benchmark-guard
Draft

aelde wants to merge 1 commit into
xarray-contrib:mainfrom
aelde:fix-3707-cupy-benchmark-guard

Conversation

@aelde

@aelde aelde commented Nov 1, 2026

Copy link
Copy Markdown

Fixes #3707.

The CuPy benchmark helper tested the has_cuda_and_cupy function object instead of calling it. On a host without usable CUDA/CuPy, this bypassed the intended NotImplementedError skip and attempted to import or use CuPy. Call the existing predicate, matching the neighboring dask+cupy branch.

Five regression cases cover CuPy absent or present with CUDA unavailable for both GPU backend choices, and confirm that the CuPy conversion path is still reached when the predicate returns true. The tests use real project imports and mock only the capability result and CuPy calls; they require no GPU.

Validation

  • python -m pytest benchmarks/tests/test_common.py -q: 5 passed; reverting the one-line fix gives 3 failed, 2 passed.
  • Real NumPy helper and Benchmarking setup/time smoke checks passed, including coordinates, shape, deterministic values and NaN handling.
  • Real unavailable CuPy, dask+cupy and RTX paths raised NotImplementedError.
  • git diff --check and pip check passed.
  • Tested on Python 3.12 with the project's minimum core dependency versions. Full suite, ASV runner, other Python versions and actual GPU execution were not run.

AI-assisted review

Reviewed using an adapted local checklist from the project's command suite, as permitted by CONTRIBUTING.md. The review checked the full changed files, capability dispatch, test failure modes, API compatibility and performance implications. No further source changes were needed.

The complete /review-pr command was not run: this review preceded PR creation, and its referenced /humanizer skill was not available locally. Numerical validation sweeps do not apply to this capability-guard-only fix. GPU execution and full-suite coverage remain unverified as noted above.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

benchmarks: cupy branch in get_xr_dataarray never raises NotImplementedError on non-GPU hosts

1 participant