Skip to content

Commit

Permalink
Updated to handle CUDA version check on machines with no GPUs (#1777)
Browse files Browse the repository at this point in the history
Updated to handle CUDA version check on machines with no GPUs. When no GPUs are present, cugraph can import and ktruss is available, which should match the original behavior prior to when the checks were added for disabling ktruss on CUDA 11.4

Tested by setting CUDA_VISIBLE_DEVICES to " ", verifying the expected exception was raised, made the change, then verified cugraph could be imported.
  • Loading branch information
rlratzel authored Aug 17, 2021
1 parent 97bfeed commit bf64c2c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
6 changes: 5 additions & 1 deletion python/cugraph/community/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@
# replace ktruss with a __UnsupportedModule instance, which lazily raises an
# exception when referenced.
from numba import cuda
__cuda_version = cuda.runtime.get_version()
try:
__cuda_version = cuda.runtime.get_version()
except cuda.cudadrv.runtime.CudaRuntimeAPIError:
__cuda_version = "n/a"

__ktruss_unsupported_cuda_version = (11, 4)

class __UnsupportedModule:
Expand Down
7 changes: 6 additions & 1 deletion python/cugraph/community/ktruss_subgraph.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,13 @@
# crash in that environment. Allow ktruss to import on non-11.4 systems, but
# raise an exception if ktruss is directly imported on 11.4.
from numba import cuda
__cuda_version = cuda.runtime.get_version()
try:
__cuda_version = cuda.runtime.get_version()
except cuda.cudadrv.runtime.CudaRuntimeAPIError:
__cuda_version = "n/a"

__ktruss_unsupported_cuda_version = (11, 4)

if __cuda_version == __ktruss_unsupported_cuda_version:
__kuvs = ".".join([str(n) for n in __ktruss_unsupported_cuda_version])
raise NotImplementedError("k_truss is not currently supported in CUDA"
Expand Down

0 comments on commit bf64c2c

Please sign in to comment.