More robust cuda and cupy identification #657
Merged
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.
This PR makes the identification of cuda and cupy more robust. Previously it was possible to have cuda present but not have cupy installed, and some branches of code would view this as sufficient for running cupy code and hence fail.
The change is to add a new function
has_cuda_and_cupy
that combines the individualhas_cuda
andhas_cupy
functions, which are now made private with underscores. Existing code has been modified to use the newhas_cuda_and_cupy()
, and all new code should use this too.Also added a
pytest.mark.skipif
decorator calledcuda_and_cupy_available
so we don't have to repeat thereason
string throughout the code.I have confirmed that tests run and pass on a cuda-enabled system in the following configurations: