Skip to content

Commit 2bfa543

Browse files
updates
1 parent 738702c commit 2bfa543

File tree

2 files changed

+29
-3
lines changed

2 files changed

+29
-3
lines changed

numba_cuda/numba/cuda/cuda_paths.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
from numba.cuda.misc.findlib import find_lib
1111
from numba.cuda import config
1212
import warnings
13+
from cuda import pathfinder
14+
import pathlib
1315

1416
_env_path_tuple = namedtuple("_env_path_tuple", ["by", "info"])
1517

@@ -516,3 +518,25 @@ def _get_include_dir():
516518
]
517519
by, include_dir = _find_valid_path(options)
518520
return _env_path_tuple(by, include_dir)
521+
522+
523+
def _get_nvvm():
524+
try:
525+
nvvm = pathfinder.load_nvidia_dynamic_lib("nvvm")
526+
return nvvm
527+
except pathfinder.DynamicLibNotFoundError:
528+
nvrtc = _get_nvrtc()
529+
path = pathlib.Path(nvrtc.abs_path)
530+
nvvm = path.parents[1] / "nvvm" / "lib64" / "libnvvm.so"
531+
532+
if nvvm.exists():
533+
dl = pathfinder._dynamic_libs.load_nvidia_dynamic_lib.load_with_abs_path(
534+
"nvvm", path, "system-search"
535+
)
536+
return dl
537+
else:
538+
raise pathfinder.DynamicLibNotFoundError("nvvm not found")
539+
540+
541+
def _get_nvrtc():
542+
return pathfinder.load_nvidia_dynamic_lib("nvrtc")

numba_cuda/numba/cuda/cudadrv/libs.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
import ctypes
1818

1919
from numba.cuda.misc.findlib import find_lib
20-
from numba.cuda.cuda_paths import get_cuda_paths
20+
from numba.cuda.cuda_paths import get_cuda_paths, _get_nvvm, _get_nvrtc
2121
from numba.cuda.cudadrv.driver import locate_driver_and_loader, load_driver
2222
from numba.cuda.cudadrv.error import CudaSupportError
2323
from numba.core import config
@@ -54,8 +54,10 @@ def get_cudalib(lib, static=False):
5454
'libnvvm.so' for 'nvvm') so that we may attempt to load it using the system
5555
loader's search mechanism.
5656
"""
57-
if lib in {"nvrtc", "nvvm"}:
58-
return pathfinder.load_nvidia_dynamic_lib(lib).abs_path
57+
if lib == "nvrtc":
58+
return _get_nvrtc().abs_path
59+
elif lib == "nvvm":
60+
return _get_nvvm().abs_path
5961
else:
6062
# cudart, cudadevrt
6163
dir_type = "static_cudalib_dir" if static else "cudalib_dir"

0 commit comments

Comments
 (0)