From 2029fe6fe9088f5c8d4e0a52416284f0c858f91f Mon Sep 17 00:00:00 2001 From: Ashwin Srinath Date: Wed, 13 Apr 2022 14:19:37 -0400 Subject: [PATCH 1/2] Handle RuntimeError thrown by CUDA Python --- python/cudf/cudf/utils/gpu_utils.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/python/cudf/cudf/utils/gpu_utils.py b/python/cudf/cudf/utils/gpu_utils.py index a722d350ef4..f303441a981 100644 --- a/python/cudf/cudf/utils/gpu_utils.py +++ b/python/cudf/cudf/utils/gpu_utils.py @@ -55,6 +55,10 @@ def validate_setup(): raise e # If there is no GPU detected, set `gpus_count` to -1 gpus_count = -1 + except RuntimeError as e: + # could indicate that `libcuda.so` is missing + warnings.warn(str(e)) + return if gpus_count > 0: # Cupy throws RunTimeException to get GPU count, From bf9f6f7a1365264d2f157800d3db552b37f9ca82 Mon Sep 17 00:00:00 2001 From: Ashwin Srinath Date: Tue, 19 Apr 2022 10:54:40 -0400 Subject: [PATCH 2/2] Additional comment --- python/cudf/cudf/utils/gpu_utils.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/python/cudf/cudf/utils/gpu_utils.py b/python/cudf/cudf/utils/gpu_utils.py index f303441a981..ab3adc1651a 100644 --- a/python/cudf/cudf/utils/gpu_utils.py +++ b/python/cudf/cudf/utils/gpu_utils.py @@ -56,7 +56,9 @@ def validate_setup(): # If there is no GPU detected, set `gpus_count` to -1 gpus_count = -1 except RuntimeError as e: - # could indicate that `libcuda.so` is missing + # 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