Skip to content

Commit 4b613e1

Browse files
authored
misc: Raise error when nvcc not found/executable (#3114)
1 parent 5a6e2e4 commit 4b613e1

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

‎devito/arch/archinfo.py‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
from packaging.version import InvalidVersion, parse
1717

1818
from devito import configuration
19+
from devito.exceptions import DevitoError
1920
from devito.logger import warning
2021
from devito.tools import all_equal, as_tuple, memoized_func
2122

@@ -573,10 +574,14 @@ def get_cuda_version():
573574
cuda_version = None
574575
try:
575576
out = run(nvc_version_command, capture_output=True, text=True)
576-
except (FileNotFoundError, CalledProcessError):
577-
pass
577+
except (FileNotFoundError, CalledProcessError) as e:
578+
out = None
579+
raise DevitoError(
580+
'Could not find or execute `nvcc` ensure that it is on the PATH or '
581+
'that CUDA_HOME or CUDA_ROOT environment variables are set correctly'
582+
) from e
578583
finally:
579-
if out.returncode == 0:
584+
if out is not None and out.returncode == 0:
580585
start = out.stdout.find('release')
581586
start = out.stdout.find(',', start) + 1
582587
stop = out.stdout.find('\n', start)

0 commit comments

Comments
 (0)