File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -310,15 +310,10 @@ def check_gpus_compute_capability(min_capability):
310310 bool
311311 """
312312
313- import importlib .util
314-
315- if importlib .util .find_spec ("cuda" ) is not None :
316- try :
317- import cuda .core .experimental as cuda_core_experimental
318- except ImportError :
319- print (
320- "cuda-python package has missed objects. Please check the installation."
321- )
313+ import sys
314+
315+ if "cuda" in sys .modules :
316+ import cuda .core .experimental as cuda_core_experimental
322317
323318 devices = cuda_core_experimental .system .devices
324319
@@ -330,11 +325,8 @@ def check_gpus_compute_capability(min_capability):
330325 if compute_capability < min_capability :
331326 return False
332327
333- elif importlib .util .find_spec ("pycuda" ) is not None :
334- try :
335- import pycuda .driver as cuda
336- except ImportError :
337- print ("PyCuda has missed objects. Please check the installation." )
328+ elif "pycuda" in sys .modules :
329+ import pycuda .driver as cuda
338330
339331 cuda .init ()
340332
@@ -347,6 +339,11 @@ def check_gpus_compute_capability(min_capability):
347339
348340 if compute_capability_value < min_capability :
349341 return False
342+ else :
343+ raise RuntimeError (
344+ "No packages found to determine the compute capability. Please check the environment."
345+ )
346+ return False
350347
351348 return True
352349
You can’t perform that action at this time.
0 commit comments