summary refs log tree commit diff
path: root/pkgs/development/python-modules/numba/cuda_path.patch
blob: 275eeb1ccab603458c8abeb1d0849d67f9296929 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
diff --git a/numba/cuda/cuda_paths.py b/numba/cuda/cuda_paths.py
index b9988bc..a642680 100644
--- a/numba/cuda/cuda_paths.py
+++ b/numba/cuda/cuda_paths.py
@@ -24,10 +24,7 @@ def _find_valid_path(options):
 
 def _get_libdevice_path_decision():
     options = [
-        ('Conda environment', get_conda_ctk()),
-        ('CUDA_HOME', get_cuda_home('nvvm', 'libdevice')),
-        ('System', get_system_ctk('nvvm', 'libdevice')),
-        ('Debian package', get_debian_pkg_libdevice()),
+        ('Nix store', get_nix_ctk('nvvm', 'libdevice')),
     ]
     by, libdir = _find_valid_path(options)
     return by, libdir
@@ -35,18 +32,16 @@ def _get_libdevice_path_decision():
 
 def _nvvm_lib_dir():
     if IS_WIN32:
-        return 'nvvm', 'bin'
+        return 'bin',
     elif IS_OSX:
-        return 'nvvm', 'lib'
+        return 'lib',
     else:
-        return 'nvvm', 'lib64'
+        return 'lib64',
 
 
 def _get_nvvm_path_decision():
     options = [
-        ('Conda environment', get_conda_ctk()),
-        ('CUDA_HOME', get_cuda_home(*_nvvm_lib_dir())),
-        ('System', get_system_ctk(*_nvvm_lib_dir())),
+        ('Nix store', get_nix_ctk(*_nvvm_lib_dir())),        
     ]
     by, path = _find_valid_path(options)
     return by, path
@@ -74,14 +69,12 @@ def _cudalib_path():
     elif IS_OSX:
         return 'lib'
     else:
-        return 'lib64'
+        return 'lib'
 
 
 def _get_cudalib_dir_path_decision():
     options = [
-        ('Conda environment', get_conda_ctk()),
-        ('CUDA_HOME', get_cuda_home(_cudalib_path())),
-        ('System', get_system_ctk(_cudalib_path())),
+        ('Nix store', get_nix_lib_ctk(_cudalib_path())),
     ]
     by, libdir = _find_valid_path(options)
     return by, libdir
@@ -92,6 +85,22 @@ def _get_cudalib_dir():
     return _env_path_tuple(by, libdir)
 
 
+def get_nix_ctk(*subdirs):
+    """Return path to nix store cudatoolkit; or, None if it doesn't exist.
+    """
+    base = '@cuda_toolkit_path@'
+    if os.path.exists(base):
+        return os.path.join(base, *subdirs)
+
+
+def get_nix_lib_ctk(*subdirs):
+    """Return path to nix store cudatoolkit-lib; or, None if it doesn't exist.
+    """
+    base = '@cuda_toolkit_lib_path@'
+    if os.path.exists(base):
+        return os.path.join(base, *subdirs)
+
+
 def get_system_ctk(*subdirs):
     """Return path to system-wide cudatoolkit; or, None if it doesn't exist.
     """