File tree Expand file tree Collapse file tree 2 files changed +29
-3
lines changed Expand file tree Collapse file tree 2 files changed +29
-3
lines changed Original file line number Diff line number Diff line change 1010from numba .cuda .misc .findlib import find_lib
1111from numba .cuda import config
1212import 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" )
Original file line number Diff line number Diff line change 1717import ctypes
1818
1919from 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
2121from numba .cuda .cudadrv .driver import locate_driver_and_loader , load_driver
2222from numba .cuda .cudadrv .error import CudaSupportError
2323from 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"
You can’t perform that action at this time.
0 commit comments