Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at litex 2.3 kB view raw
1diff --git a/numba/cuda/cuda_paths.py b/numba/cuda/cuda_paths.py 2index 0da435d33..7b1fde087 100644 3--- a/numba/cuda/cuda_paths.py 4+++ b/numba/cuda/cuda_paths.py 5@@ -24,10 +24,7 @@ def _find_valid_path(options): 6 7 def _get_libdevice_path_decision(): 8 options = [ 9- ('Conda environment', get_conda_ctk()), 10- ('CUDA_HOME', get_cuda_home('nvvm', 'libdevice')), 11- ('System', get_system_ctk('nvvm', 'libdevice')), 12- ('Debian package', get_debian_pkg_libdevice()), 13+ ('Nix store', get_nix_ctk('nvvm', 'libdevice')), 14 ] 15 by, libdir = _find_valid_path(options) 16 return by, libdir 17@@ -35,16 +32,14 @@ def _get_libdevice_path_decision(): 18 19 def _nvvm_lib_dir(): 20 if IS_WIN32: 21- return 'nvvm', 'bin' 22+ return 'bin', 23 else: 24- return 'nvvm', 'lib64' 25+ return 'lib64', 26 27 28 def _get_nvvm_path_decision(): 29 options = [ 30- ('Conda environment', get_conda_ctk()), 31- ('CUDA_HOME', get_cuda_home(*_nvvm_lib_dir())), 32- ('System', get_system_ctk(*_nvvm_lib_dir())), 33+ ('Nix store', get_nix_ctk(*_nvvm_lib_dir())), 34 ] 35 by, path = _find_valid_path(options) 36 return by, path 37@@ -64,14 +59,12 @@ def _cudalib_path(): 38 if IS_WIN32: 39 return 'bin' 40 else: 41- return 'lib64' 42+ return 'lib' 43 44 45 def _get_cudalib_dir_path_decision(): 46 options = [ 47- ('Conda environment', get_conda_ctk()), 48- ('CUDA_HOME', get_cuda_home(_cudalib_path())), 49- ('System', get_system_ctk(_cudalib_path())), 50+ ('Nix store', get_nix_lib_ctk(_cudalib_path())), 51 ] 52 by, libdir = _find_valid_path(options) 53 return by, libdir 54@@ -82,6 +75,22 @@ def _get_cudalib_dir(): 55 return _env_path_tuple(by, libdir) 56 57 58+def get_nix_ctk(*subdirs): 59+ """Return path to nix store cudatoolkit; or, None if it doesn't exist. 60+ """ 61+ base = '@cuda_toolkit_path@' 62+ if os.path.exists(base): 63+ return os.path.join(base, *subdirs) 64+ 65+ 66+def get_nix_lib_ctk(*subdirs): 67+ """Return path to nix store cudatoolkit-lib; or, None if it doesn't exist. 68+ """ 69+ base = '@cuda_toolkit_lib_path@' 70+ if os.path.exists(base): 71+ return os.path.join(base, *subdirs) 72+ 73+ 74 def get_system_ctk(*subdirs): 75 """Return path to system-wide cudatoolkit; or, None if it doesn't exist. 76 """