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

Open Beginner friendly
#3,707 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
1/5
Estimated time
1-3 hours
Newbie friendliness
88/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
python
Domain
performance

Research direction

Open benchmarks/benchmarks/common.py and inspect get_xr_dataarray, comparing the older cupy branch with the dask+cupy branch from #3706. Confirm the non-CUDA path invokes the availability check before importing cupy and raises NotImplementedError, then run the most practical available guard-behavior check.

Written by the indexing model from the issue text.

Description

bug

benchmarks/benchmarks/common.py gates the cupy branch with if not has_cuda_and_cupy: — but has_cuda_and_cupy is a function, so the expression is always false and the guard never fires. On a host without CUDA the branch falls through to import cupy and the benchmark dies with ImportError instead of being skipped via NotImplementedError.

The dask+cupy branch added in #3706 calls the function correctly; this fixes the older branch to match. One-line change plus whatever guard-behavior check is practical without a GPU-less CI lane.

Spotted during the #3706 review; kept out of that PR to leave the diff scoped.

Dominant language
Python
Stars
972
Forks
92
Avg merge
2d 12h
Merged PRs (30d)
7

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from xarray-contrib/xarray-spatial

All issues in xarray-contrib/xarray-spatial

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.