Skip to content

Commit

Permalink
Handle RuntimeError thrown by CUDA Python in validate_setup (#10653)
Browse files Browse the repository at this point in the history
The call to `getDeviceCount()` can raise a `RuntimeError` when `libcuda.so` is missing. We should handle that too in `validate_setup()`.

Authors:
  - Ashwin Srinath (https://github.com/shwina)

Approvers:
  - Charles Blackmon-Luca (https://github.com/charlesbluca)
  - GALI PREM SAGAR (https://github.com/galipremsagar)

URL: #10653
  • Loading branch information
shwina authored Apr 19, 2022
1 parent 565f474 commit 304711a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions python/cudf/cudf/utils/gpu_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ def validate_setup():
raise e
# If there is no GPU detected, set `gpus_count` to -1
gpus_count = -1
except RuntimeError as e:
# getDeviceCount() can raise a RuntimeError
# when ``libcuda.so`` is missing.
# We don't want this to propagate up to the user.
warnings.warn(str(e))
return

if gpus_count > 0:
# Cupy throws RunTimeException to get GPU count,
Expand Down

0 comments on commit 304711a

Please sign in to comment.