Skip to content

Commit 166837d

Browse files
committed
Remove cuda_paths.py dependency on numba.cuda.cudadrv.runtime
1 parent 714b88c commit 166837d

File tree

1 file changed

+5
-13
lines changed

1 file changed

+5
-13
lines changed

cuda_bindings/cuda/bindings/_path_finder/cuda_paths.py

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -167,14 +167,6 @@ def _get_nvvm_wheel():
167167
return None
168168

169169

170-
def get_major_cuda_version():
171-
# TODO: remove once cuda-python is
172-
# a hard dependency
173-
from numba.cuda.cudadrv.runtime import get_version
174-
175-
return get_version()[0]
176-
177-
178170
def get_nvrtc_dso_path():
179171
site_paths = [site.getusersitepackages()] + site.getsitepackages()
180172
for sp in site_paths:
@@ -185,21 +177,21 @@ def get_nvrtc_dso_path():
185177
("bin" if IS_WIN32 else "lib") if sp else None,
186178
)
187179
if lib_dir and os.path.exists(lib_dir):
188-
try:
189-
major = get_major_cuda_version()
180+
for major in (12, 11):
190181
if major == 11:
191182
cu_ver = "112" if IS_WIN32 else "11.2"
192183
elif major == 12:
193184
cu_ver = "120" if IS_WIN32 else "12"
194185
else:
195186
raise NotImplementedError(f"CUDA {major} is not supported")
196187

197-
return os.path.join(
188+
dso_path = os.path.join(
198189
lib_dir,
199190
f"nvrtc64_{cu_ver}_0.dll" if IS_WIN32 else f"libnvrtc.so.{cu_ver}",
200191
)
201-
except RuntimeError:
202-
continue
192+
if os.path.isfile(dso_path):
193+
return dso_path
194+
return None
203195

204196

205197
def _get_nvrtc_wheel():

0 commit comments

Comments
 (0)