python3Packages.cuda-bindings: support multiple versions of cudaPackages
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
{
|
||||
replaceVars,
|
||||
cudaLibPaths,
|
||||
}:
|
||||
{
|
||||
version = "12.9.6";
|
||||
sourceHash = "sha256-uRv27h2b6wXC8oOf5k2KxZ0bUFNvNu6XO05FBbJcU1k=";
|
||||
|
||||
nvidiaLibsPatch = replaceVars ./patch-nvidia-libs-paths_12_9.patch {
|
||||
inherit (cudaLibPaths)
|
||||
libcudart
|
||||
libcufile
|
||||
libnvfatbin
|
||||
libnvjitlink
|
||||
libnvml
|
||||
libnvrtc
|
||||
libnvvm
|
||||
;
|
||||
};
|
||||
|
||||
pythonImportsCheck = [
|
||||
"cuda.bindings.nvfatbin"
|
||||
"cuda.bindings.nvml"
|
||||
];
|
||||
|
||||
disabledTests = [
|
||||
# sysfs cpu topology is not available in the sandbox, causing:
|
||||
# cuda.bindings.nvml.UnknownError: Unknown Error
|
||||
# hwloc/linux: failed to find sysfs cpu topology directory, aborting linux discovery.
|
||||
"test_device_get_cpu_affinity_within_scope"
|
||||
"test_device_get_memory_affinity"
|
||||
|
||||
# Requires the nvidia_fs kernel module (GPUDirect Storage), causing:
|
||||
# cuda.bindings.cufile.cuFileError: NVFS_SETUP_ERROR (5033): NVFS driver initialization error
|
||||
"test_buf_register_already_registered"
|
||||
"test_buf_register_host_memory"
|
||||
"test_buf_register_invalid_flags"
|
||||
"test_buf_register_large_buffer"
|
||||
"test_buf_register_multiple_buffers"
|
||||
"test_buf_register_simple"
|
||||
"test_driver_open"
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
{
|
||||
replaceVars,
|
||||
cudaLibPaths,
|
||||
}:
|
||||
{
|
||||
version = "13.0.3";
|
||||
sourceHash = "sha256-Uq1oQWtilocQPh6cZ3P/L/L6caCHv17u1y67sm5fhhA=";
|
||||
|
||||
nvidiaLibsPatch = replaceVars ./patch-nvidia-libs-paths_13_0.patch {
|
||||
inherit (cudaLibPaths)
|
||||
libcudart
|
||||
libcufile
|
||||
libnvjitlink
|
||||
libnvrtc
|
||||
libnvvm
|
||||
;
|
||||
};
|
||||
|
||||
postPatch = ''
|
||||
substituteInPlace pyproject.toml \
|
||||
--replace-fail "cython>=3.1,<3.2" "cython"
|
||||
'';
|
||||
|
||||
disabledTests = [
|
||||
# Requires the nvidia_fs kernel module (GPUDirect Storage), causing:
|
||||
# cuda.bindings.cufile.cuFileError: NVFS_SETUP_ERROR (5033): NVFS driver initialization error
|
||||
"test_buf_register_already_registered"
|
||||
"test_buf_register_host_memory"
|
||||
"test_buf_register_invalid_flags"
|
||||
"test_buf_register_large_buffer"
|
||||
"test_buf_register_multiple_buffers"
|
||||
"test_buf_register_simple"
|
||||
"test_driver_open"
|
||||
"test_get_bar_size_in_kb"
|
||||
"test_get_parameter_min_max_value"
|
||||
"test_set_parameter_posix_pool_slab_array"
|
||||
"test_set_stats_level"
|
||||
"test_stats_start_stop"
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
{
|
||||
replaceVars,
|
||||
cudaLibPaths,
|
||||
}:
|
||||
{
|
||||
version = "13.1.1";
|
||||
sourceHash = "sha256-AvIw2G4EGWsX7PxFGxzECXhwkbwYslHzRdUArTNf7jE=";
|
||||
|
||||
nvidiaLibsPatch = replaceVars ./patch-nvidia-libs-paths_13_1.patch {
|
||||
inherit (cudaLibPaths)
|
||||
libcudart
|
||||
libcufile
|
||||
libnvjitlink
|
||||
libnvml
|
||||
libnvrtc
|
||||
libnvvm
|
||||
;
|
||||
};
|
||||
|
||||
pythonImportsCheck = [
|
||||
"cuda.bindings._nvml"
|
||||
];
|
||||
|
||||
disabledTests = [
|
||||
# sysfs cpu topology is not available in the sandbox, causing:
|
||||
# cuda.bindings._nvml.UnknownError: Unknown Error
|
||||
# hwloc/linux: failed to find sysfs cpu topology directory, aborting linux discovery.
|
||||
"test_device_get_cpu_affinity_within_scope"
|
||||
"test_device_get_memory_affinity"
|
||||
|
||||
# Requires the nvidia_fs kernel module (GPUDirect Storage), causing:
|
||||
# cuda.bindings.cufile.cuFileError: NVFS_SETUP_ERROR (5033): NVFS driver initialization error
|
||||
"test_buf_register_already_registered"
|
||||
"test_buf_register_host_memory"
|
||||
"test_buf_register_invalid_flags"
|
||||
"test_buf_register_large_buffer"
|
||||
"test_buf_register_multiple_buffers"
|
||||
"test_buf_register_simple"
|
||||
"test_get_bar_size_in_kb"
|
||||
"test_get_parameter_min_max_value"
|
||||
"test_set_parameter_posix_pool_slab_array"
|
||||
"test_set_stats_level"
|
||||
"test_stats_start_stop"
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
{
|
||||
replaceVars,
|
||||
cudaLibPaths,
|
||||
}:
|
||||
{
|
||||
version = "13.2.0";
|
||||
sourceHash = "sha256-VOaRjZwg1phGjkOeXjWMcs/vjlPMNKiVSKyKrQG5ohM=";
|
||||
|
||||
nvidiaLibsPatch = replaceVars ./patch-nvidia-libs-paths_13_2.patch {
|
||||
inherit (cudaLibPaths)
|
||||
libcudart
|
||||
libcufile
|
||||
libnvfatbin
|
||||
libnvjitlink
|
||||
libnvml
|
||||
libnvrtc
|
||||
libnvvm
|
||||
;
|
||||
};
|
||||
|
||||
pythonImportsCheck = [
|
||||
"cuda.bindings.nvfatbin"
|
||||
"cuda.bindings.nvml"
|
||||
];
|
||||
|
||||
disabledTests = [
|
||||
# Requires GPU discovery support not available in the test environment
|
||||
"test_discover_gpus"
|
||||
|
||||
# sysfs cpu topology is not available in the sandbox, causing:
|
||||
# cuda.bindings.nvml.UnknownError: Unknown Error
|
||||
# hwloc/linux: failed to find sysfs cpu topology directory, aborting linux discovery.
|
||||
"test_device_get_cpu_affinity_within_scope"
|
||||
"test_device_get_memory_affinity"
|
||||
|
||||
# Requires the nvidia_fs kernel module (GPUDirect Storage), causing:
|
||||
# cuda.bindings.cufile.cuFileError: NVFS_SETUP_ERROR (5033): NVFS driver initialization error
|
||||
"test_buf_register_already_registered"
|
||||
"test_buf_register_host_memory"
|
||||
"test_buf_register_invalid_flags"
|
||||
"test_buf_register_large_buffer"
|
||||
"test_buf_register_multiple_buffers"
|
||||
"test_buf_register_simple"
|
||||
"test_get_bar_size_in_kb"
|
||||
"test_get_parameter_min_max_value"
|
||||
"test_set_parameter_posix_pool_slab_array"
|
||||
"test_set_stats_level"
|
||||
"test_stats_start_stop"
|
||||
];
|
||||
}
|
||||
@@ -19,15 +19,49 @@
|
||||
numpy,
|
||||
|
||||
# tests
|
||||
cuda-pathfinder,
|
||||
pytest-benchmark,
|
||||
pytestCheckHook,
|
||||
util-linux,
|
||||
|
||||
# passthru
|
||||
cuda-bindings,
|
||||
}:
|
||||
|
||||
let
|
||||
cudaVersion = cudaPackages.cudaMajorMinorVersion;
|
||||
|
||||
versionSpecificAttrs =
|
||||
let
|
||||
args = {
|
||||
inherit replaceVars;
|
||||
cudaLibPaths = {
|
||||
libcudart = lib.getLib cudaPackages.cuda_cudart;
|
||||
libcufile = lib.getLib cudaPackages.libcufile;
|
||||
libnvfatbin = lib.getLib cudaPackages.libnvfatbin;
|
||||
libnvjitlink = lib.getLib cudaPackages.libnvjitlink;
|
||||
libnvml = addDriverRunpath.driverLink;
|
||||
libnvrtc = lib.getLib cudaPackages.cuda_nvrtc;
|
||||
libnvvm =
|
||||
if cudaOlder "13.0" then "${cudaPackages.cuda_nvcc}/nvvm" else lib.getLib cudaPackages.libnvvm;
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
# cuda-bindings patch versions DO NOT correspond to cuda toolkits' own path versions.
|
||||
# Only major.minor is supposed to match
|
||||
"12.9" = import ./12_9.nix args;
|
||||
"13.0" = import ./13_0.nix args;
|
||||
"13.1" = import ./13_1.nix args;
|
||||
"13.2" = import ./13_2.nix args;
|
||||
}
|
||||
.${cudaVersion} or (throw "Unsupported cuda-bindings version: ${cudaVersion}");
|
||||
|
||||
inherit (cudaPackages) cudaOlder cudaAtLeast;
|
||||
in
|
||||
buildPythonPackage (finalAttrs: {
|
||||
pname = "cuda-bindings";
|
||||
version = "12.9.6";
|
||||
inherit (versionSpecificAttrs) version;
|
||||
pyproject = true;
|
||||
__structuredAttrs = true;
|
||||
|
||||
@@ -35,22 +69,14 @@ buildPythonPackage (finalAttrs: {
|
||||
owner = "NVIDIA";
|
||||
repo = "cuda-python";
|
||||
tag = "v${finalAttrs.version}";
|
||||
hash = "sha256-uRv27h2b6wXC8oOf5k2KxZ0bUFNvNu6XO05FBbJcU1k=";
|
||||
hash = versionSpecificAttrs.sourceHash;
|
||||
};
|
||||
|
||||
# Apply patch relative to cuda_bindings
|
||||
patchFlags = [ "-p2" ];
|
||||
|
||||
patches = [
|
||||
(replaceVars ./patch-nvidia-libs-paths.patch {
|
||||
libcudart = lib.getLib cudaPackages.cuda_cudart;
|
||||
libcufile = lib.getLib cudaPackages.libcufile;
|
||||
libnvfatbin = lib.getLib cudaPackages.libnvfatbin;
|
||||
libnvjitlink = lib.getLib cudaPackages.libnvjitlink;
|
||||
libnvml = addDriverRunpath.driverLink;
|
||||
libnvrtc = lib.getLib cudaPackages.cuda_nvrtc;
|
||||
libnvvm = "${cudaPackages.cuda_nvcc}/nvvm";
|
||||
})
|
||||
versionSpecificAttrs.nvidiaLibsPatch
|
||||
];
|
||||
|
||||
sourceRoot = "${finalAttrs.src.name}/cuda_bindings";
|
||||
@@ -76,7 +102,8 @@ buildPythonPackage (finalAttrs: {
|
||||
--replace-fail \
|
||||
"path = 'libcuda.so.1'" \
|
||||
"path = '${libCudaPath}/lib/libcuda.so.1'"
|
||||
'';
|
||||
''
|
||||
+ (versionSpecificAttrs.postPatch or "");
|
||||
|
||||
preBuild = ''
|
||||
export CUDA_PYTHON_PARALLEL_LEVEL=$NIX_BUILD_CORES
|
||||
@@ -101,8 +128,14 @@ buildPythonPackage (finalAttrs: {
|
||||
};
|
||||
|
||||
buildInputs = [
|
||||
cudaPackages.cuda_nvcc # crt/host_defines.h
|
||||
cudaPackages.libcufile # cufile.h
|
||||
]
|
||||
# Until 13.0, crt headers are shipped in nvcc
|
||||
++ lib.optionals (cudaOlder "13.0") [
|
||||
cudaPackages.cuda_nvcc # crt/host_defines.h
|
||||
]
|
||||
++ lib.optionals (cudaAtLeast "13.0") [
|
||||
cudaPackages.cuda_crt # crt/host_defines.h
|
||||
];
|
||||
|
||||
pythonRemoveDeps = [
|
||||
@@ -118,13 +151,12 @@ buildPythonPackage (finalAttrs: {
|
||||
"cuda"
|
||||
"cuda.bindings.cufile"
|
||||
"cuda.bindings.driver"
|
||||
"cuda.bindings.nvfatbin"
|
||||
"cuda.bindings.nvjitlink"
|
||||
"cuda.bindings.nvml"
|
||||
"cuda.bindings.nvrtc"
|
||||
"cuda.bindings.nvvm"
|
||||
"cuda.bindings.runtime"
|
||||
];
|
||||
]
|
||||
++ (versionSpecificAttrs.pythonImportsCheck or [ ]);
|
||||
|
||||
preCheck = ''
|
||||
rm -rf cuda
|
||||
@@ -132,38 +164,28 @@ buildPythonPackage (finalAttrs: {
|
||||
|
||||
nativeCheckInputs = [
|
||||
pytestCheckHook
|
||||
]
|
||||
++ lib.optionals (cudaPackages.cudaAtLeast "13.0") [
|
||||
# Although we don't want cuda.pathfinder as a dependency (to handle dlopens), it is imported by
|
||||
# some tests
|
||||
cuda-pathfinder
|
||||
|
||||
pytest-benchmark
|
||||
util-linux # findmnt
|
||||
];
|
||||
|
||||
enabledTestPaths = [
|
||||
"tests/"
|
||||
];
|
||||
|
||||
disabledTestPaths = [
|
||||
disabledTestPaths = lib.optionals (cudaOlder "13.0") [
|
||||
# The current driver shipped in NixOS (590.48.01) advertises CUDA 13.1, causing the following
|
||||
# error:
|
||||
# cuda.bindings._internal.utils.NotSupportedError: only CUDA 12 driver is supported
|
||||
#
|
||||
# Ideally, we should transition to cuda 13 across the whole nixpkgs tree.
|
||||
"tests/test_nvjitlink.py"
|
||||
];
|
||||
|
||||
disabledTests = [
|
||||
# sysfs cpu topology is not available in the sandbox, causing:
|
||||
# cuda.bindings.nvml.UnknownError: Unknown Error
|
||||
# hwloc/linux: failed to find sysfs cpu topology directory, aborting linux discovery.
|
||||
"test_device_get_cpu_affinity_within_scope"
|
||||
"test_device_get_memory_affinity"
|
||||
|
||||
# Requires the nvidia_fs kernel module (GPUDirect Storage), causing:
|
||||
# cuda.bindings.cufile.cuFileError: NVFS_SETUP_ERROR (5033): NVFS driver initialization error
|
||||
"test_buf_register_already_registered"
|
||||
"test_buf_register_host_memory"
|
||||
"test_buf_register_invalid_flags"
|
||||
"test_buf_register_large_buffer"
|
||||
"test_buf_register_multiple_buffers"
|
||||
"test_buf_register_simple"
|
||||
"test_driver_open"
|
||||
];
|
||||
disabledTests = versionSpecificAttrs.disabledTests or [ ];
|
||||
|
||||
# Tests need access to a GPU
|
||||
doCheck = false;
|
||||
|
||||
@@ -0,0 +1,125 @@
|
||||
diff --git a/cuda_bindings/cuda/bindings/_bindings/cynvrtc.pyx.in b/cuda_bindings/cuda/bindings/_bindings/cynvrtc.pyx.in
|
||||
index 8409032852..b3a04478c2 100644
|
||||
--- a/cuda_bindings/cuda/bindings/_bindings/cynvrtc.pyx.in
|
||||
+++ b/cuda_bindings/cuda/bindings/_bindings/cynvrtc.pyx.in
|
||||
@@ -8,7 +8,7 @@ cimport cuda.bindings._lib.windll as windll
|
||||
{{else}}
|
||||
cimport cuda.bindings._lib.dlfcn as dlfcn
|
||||
{{endif}}
|
||||
-from cuda.pathfinder import load_nvidia_dynamic_lib
|
||||
+from ctypes import CDLL
|
||||
from libc.stdint cimport intptr_t, uintptr_t
|
||||
import threading
|
||||
|
||||
@@ -45,7 +45,7 @@ cdef int _cuPythonInit() except -1 nogil:
|
||||
# Load library
|
||||
with gil, __symbol_lock:
|
||||
{{if 'Windows' == platform.system()}}
|
||||
- handle = load_nvidia_dynamic_lib("nvrtc")._handle_uint
|
||||
+ handle = CDLL("@libnvrtc@/lib/libnvrtc.so")._handle
|
||||
|
||||
# Load function
|
||||
{{if 'nvrtcGetErrorString' in found_functions}}
|
||||
@@ -146,7 +146,7 @@ cdef int _cuPythonInit() except -1 nogil:
|
||||
{{endif}}
|
||||
|
||||
{{else}}
|
||||
- handle = <void*><uintptr_t>(load_nvidia_dynamic_lib("nvrtc")._handle_uint)
|
||||
+ handle = <void*><uintptr_t>(CDLL("@libnvrtc@/lib/libnvrtc.so")._handle)
|
||||
|
||||
# Load function
|
||||
{{if 'nvrtcGetErrorString' in found_functions}}
|
||||
diff --git a/cuda_bindings/cuda/bindings/_internal/cufile_linux.pyx b/cuda_bindings/cuda/bindings/_internal/cufile_linux.pyx
|
||||
index 33b6384647..9fe3eb78e4 100644
|
||||
--- a/cuda_bindings/cuda/bindings/_internal/cufile_linux.pyx
|
||||
+++ b/cuda_bindings/cuda/bindings/_internal/cufile_linux.pyx
|
||||
@@ -9,7 +9,7 @@ import threading
|
||||
|
||||
from .utils import FunctionNotFoundError, NotSupportedError
|
||||
|
||||
-from cuda.pathfinder import load_nvidia_dynamic_lib
|
||||
+from ctypes import CDLL
|
||||
|
||||
import cython
|
||||
|
||||
@@ -107,7 +107,7 @@ cdef void* __cuFileGetParameterPosixPoolSlabArray = NULL
|
||||
|
||||
|
||||
cdef void* load_library() except* with gil:
|
||||
- cdef uintptr_t handle = load_nvidia_dynamic_lib("cufile")._handle_uint
|
||||
+ cdef uintptr_t handle = CDLL("@libcufile@/lib/libcufile.so")._handle
|
||||
return <void*>handle
|
||||
|
||||
|
||||
diff --git a/cuda_bindings/cuda/bindings/_internal/nvjitlink_linux.pyx b/cuda_bindings/cuda/bindings/_internal/nvjitlink_linux.pyx
|
||||
index a8e2b4e56b..917facb824 100644
|
||||
--- a/cuda_bindings/cuda/bindings/_internal/nvjitlink_linux.pyx
|
||||
+++ b/cuda_bindings/cuda/bindings/_internal/nvjitlink_linux.pyx
|
||||
@@ -9,7 +9,7 @@ from libc.stdint cimport intptr_t, uintptr_t
|
||||
import threading
|
||||
from .utils import FunctionNotFoundError, NotSupportedError
|
||||
|
||||
-from cuda.pathfinder import load_nvidia_dynamic_lib
|
||||
+from ctypes import CDLL
|
||||
|
||||
|
||||
###############################################################################
|
||||
@@ -76,7 +76,7 @@ cdef void* __nvJitLinkVersion = NULL
|
||||
|
||||
|
||||
cdef void* load_library() except* with gil:
|
||||
- cdef uintptr_t handle = load_nvidia_dynamic_lib("nvJitLink")._handle_uint
|
||||
+ cdef uintptr_t handle = CDLL("@libnvjitlink@/lib/libnvJitLink.so")._handle
|
||||
return <void*>handle
|
||||
|
||||
|
||||
diff --git a/cuda_bindings/cuda/bindings/_internal/nvvm_linux.pyx b/cuda_bindings/cuda/bindings/_internal/nvvm_linux.pyx
|
||||
index 64d97334b9..d325e68ea7 100644
|
||||
--- a/cuda_bindings/cuda/bindings/_internal/nvvm_linux.pyx
|
||||
+++ b/cuda_bindings/cuda/bindings/_internal/nvvm_linux.pyx
|
||||
@@ -9,7 +9,7 @@ from libc.stdint cimport intptr_t, uintptr_t
|
||||
import threading
|
||||
from .utils import FunctionNotFoundError, NotSupportedError
|
||||
|
||||
-from cuda.pathfinder import load_nvidia_dynamic_lib
|
||||
+from ctypes import CDLL
|
||||
|
||||
|
||||
###############################################################################
|
||||
@@ -75,7 +75,7 @@ cdef void* __nvvmGetProgramLog = NULL
|
||||
|
||||
|
||||
cdef void* load_library() except* with gil:
|
||||
- cdef uintptr_t handle = load_nvidia_dynamic_lib("nvvm")._handle_uint
|
||||
+ cdef uintptr_t handle = CDLL("@libnvvm@/lib/libnvvm.so")._handle
|
||||
return <void*>handle
|
||||
|
||||
|
||||
diff --git a/cuda_bindings/cuda/bindings/cyruntime.pyx.in b/cuda_bindings/cuda/bindings/cyruntime.pyx.in
|
||||
index 3031e43d2f..bb83421b46 100644
|
||||
--- a/cuda_bindings/cuda/bindings/cyruntime.pyx.in
|
||||
+++ b/cuda_bindings/cuda/bindings/cyruntime.pyx.in
|
||||
@@ -1886,7 +1886,7 @@ cdef cudaError_t cudaGraphicsVDPAURegisterOutputSurface(cudaGraphicsResource** r
|
||||
{{if True}}
|
||||
|
||||
from libc.stdint cimport uintptr_t
|
||||
-from cuda.pathfinder import load_nvidia_dynamic_lib
|
||||
+from ctypes import CDLL
|
||||
{{if 'Windows' == platform.system()}}
|
||||
cimport cuda.bindings._lib.windll as windll
|
||||
{{else}}
|
||||
@@ -1896,11 +1896,11 @@ cimport cuda.bindings._lib.dlfcn as dlfcn
|
||||
cdef cudaError_t getLocalRuntimeVersion(int* runtimeVersion) except ?cudaErrorCallRequiresNewerDriver nogil:
|
||||
# Load
|
||||
with gil:
|
||||
- loaded_dl = load_nvidia_dynamic_lib("cudart")
|
||||
+ loaded_dl = CDLL("@libcudart@/lib/libcudart.so")
|
||||
{{if 'Windows' == platform.system()}}
|
||||
- handle = <uintptr_t>loaded_dl._handle_uint
|
||||
+ handle = <uintptr_t>loaded_dl._handle
|
||||
{{else}}
|
||||
- handle = <void *><uintptr_t>loaded_dl._handle_uint
|
||||
+ handle = <void *><uintptr_t>loaded_dl._handle
|
||||
{{endif}}
|
||||
|
||||
{{if 'Windows' == platform.system()}}
|
||||
@@ -0,0 +1,147 @@
|
||||
diff --git a/cuda_bindings/cuda/bindings/_bindings/cynvrtc.pyx.in b/cuda_bindings/cuda/bindings/_bindings/cynvrtc.pyx.in
|
||||
index 608aebd1af..7f60917f71 100644
|
||||
--- a/cuda_bindings/cuda/bindings/_bindings/cynvrtc.pyx.in
|
||||
+++ b/cuda_bindings/cuda/bindings/_bindings/cynvrtc.pyx.in
|
||||
@@ -8,7 +8,7 @@ cimport cuda.bindings._lib.windll as windll
|
||||
{{else}}
|
||||
cimport cuda.bindings._lib.dlfcn as dlfcn
|
||||
{{endif}}
|
||||
-from cuda.pathfinder import load_nvidia_dynamic_lib
|
||||
+from ctypes import CDLL
|
||||
from libc.stdint cimport intptr_t, uintptr_t
|
||||
import threading
|
||||
|
||||
@@ -45,7 +45,7 @@ cdef int _cuPythonInit() except -1 nogil:
|
||||
# Load library
|
||||
with gil, __symbol_lock:
|
||||
{{if 'Windows' == platform.system()}}
|
||||
- handle = load_nvidia_dynamic_lib("nvrtc")._handle_uint
|
||||
+ handle = CDLL("@libnvrtc@/lib/libnvrtc.so")._handle
|
||||
|
||||
# Load function
|
||||
{{if 'nvrtcGetErrorString' in found_functions}}
|
||||
@@ -146,7 +146,7 @@ cdef int _cuPythonInit() except -1 nogil:
|
||||
{{endif}}
|
||||
|
||||
{{else}}
|
||||
- handle = <void*><uintptr_t>(load_nvidia_dynamic_lib("nvrtc")._handle_uint)
|
||||
+ handle = <void*><uintptr_t>(CDLL("@libnvrtc@/lib/libnvrtc.so")._handle)
|
||||
|
||||
# Load function
|
||||
{{if 'nvrtcGetErrorString' in found_functions}}
|
||||
diff --git a/cuda_bindings/cuda/bindings/_internal/_nvml_linux.pyx b/cuda_bindings/cuda/bindings/_internal/_nvml_linux.pyx
|
||||
index 1622cc82aa..ddff5dad75 100644
|
||||
--- a/cuda_bindings/cuda/bindings/_internal/_nvml_linux.pyx
|
||||
+++ b/cuda_bindings/cuda/bindings/_internal/_nvml_linux.pyx
|
||||
@@ -10,7 +10,7 @@ import threading
|
||||
|
||||
from .utils import FunctionNotFoundError, NotSupportedError
|
||||
|
||||
-from cuda.pathfinder import load_nvidia_dynamic_lib
|
||||
+from ctypes import CDLL
|
||||
|
||||
|
||||
###############################################################################
|
||||
@@ -410,7 +410,7 @@ cdef void* __nvmlDeviceGetSramUniqueUncorrectedEccErrorCounts = NULL
|
||||
|
||||
|
||||
cdef void* load_library() except* with gil:
|
||||
- return dlopen("libnvidia-ml.so.1", RTLD_NOW | RTLD_GLOBAL)
|
||||
+ return dlopen("@libnvml@/lib/libnvidia-ml.so.1", RTLD_NOW | RTLD_GLOBAL)
|
||||
|
||||
|
||||
cdef int _init_nvml() except -1 nogil:
|
||||
diff --git a/cuda_bindings/cuda/bindings/_internal/cufile_linux.pyx b/cuda_bindings/cuda/bindings/_internal/cufile_linux.pyx
|
||||
index c64eb00c5c..9ba4ea2727 100644
|
||||
--- a/cuda_bindings/cuda/bindings/_internal/cufile_linux.pyx
|
||||
+++ b/cuda_bindings/cuda/bindings/_internal/cufile_linux.pyx
|
||||
@@ -9,7 +9,7 @@ import threading
|
||||
|
||||
from .utils import FunctionNotFoundError, NotSupportedError
|
||||
|
||||
-from cuda.pathfinder import load_nvidia_dynamic_lib
|
||||
+from ctypes import CDLL
|
||||
|
||||
import cython
|
||||
|
||||
@@ -107,7 +107,7 @@ cdef void* __cuFileGetParameterPosixPoolSlabArray = NULL
|
||||
|
||||
|
||||
cdef void* load_library() except* with gil:
|
||||
- cdef uintptr_t handle = load_nvidia_dynamic_lib("cufile")._handle_uint
|
||||
+ cdef uintptr_t handle = CDLL("@libcufile@/lib/libcufile.so")._handle
|
||||
return <void*>handle
|
||||
|
||||
|
||||
diff --git a/cuda_bindings/cuda/bindings/_internal/nvjitlink_linux.pyx b/cuda_bindings/cuda/bindings/_internal/nvjitlink_linux.pyx
|
||||
index 8c96b6d640..96761a95ae 100644
|
||||
--- a/cuda_bindings/cuda/bindings/_internal/nvjitlink_linux.pyx
|
||||
+++ b/cuda_bindings/cuda/bindings/_internal/nvjitlink_linux.pyx
|
||||
@@ -9,7 +9,7 @@ from libc.stdint cimport intptr_t, uintptr_t
|
||||
import threading
|
||||
from .utils import FunctionNotFoundError, NotSupportedError
|
||||
|
||||
-from cuda.pathfinder import load_nvidia_dynamic_lib
|
||||
+from ctypes import CDLL
|
||||
|
||||
|
||||
###############################################################################
|
||||
@@ -76,7 +76,7 @@ cdef void* __nvJitLinkVersion = NULL
|
||||
|
||||
|
||||
cdef void* load_library() except* with gil:
|
||||
- cdef uintptr_t handle = load_nvidia_dynamic_lib("nvJitLink")._handle_uint
|
||||
+ cdef uintptr_t handle = CDLL("@libnvjitlink@/lib/libnvJitLink.so")._handle
|
||||
return <void*>handle
|
||||
|
||||
|
||||
diff --git a/cuda_bindings/cuda/bindings/_internal/nvvm_linux.pyx b/cuda_bindings/cuda/bindings/_internal/nvvm_linux.pyx
|
||||
index 408a2cb592..2b31888e1f 100644
|
||||
--- a/cuda_bindings/cuda/bindings/_internal/nvvm_linux.pyx
|
||||
+++ b/cuda_bindings/cuda/bindings/_internal/nvvm_linux.pyx
|
||||
@@ -9,7 +9,7 @@ from libc.stdint cimport intptr_t, uintptr_t
|
||||
import threading
|
||||
from .utils import FunctionNotFoundError, NotSupportedError
|
||||
|
||||
-from cuda.pathfinder import load_nvidia_dynamic_lib
|
||||
+from ctypes import CDLL
|
||||
|
||||
|
||||
###############################################################################
|
||||
@@ -75,7 +75,7 @@ cdef void* __nvvmGetProgramLog = NULL
|
||||
|
||||
|
||||
cdef void* load_library() except* with gil:
|
||||
- cdef uintptr_t handle = load_nvidia_dynamic_lib("nvvm")._handle_uint
|
||||
+ cdef uintptr_t handle = CDLL("@libnvvm@/lib/libnvvm.so")._handle
|
||||
return <void*>handle
|
||||
|
||||
|
||||
diff --git a/cuda_bindings/cuda/bindings/cyruntime.pyx.in b/cuda_bindings/cuda/bindings/cyruntime.pyx.in
|
||||
index 248346d274..e041b41d69 100644
|
||||
--- a/cuda_bindings/cuda/bindings/cyruntime.pyx.in
|
||||
+++ b/cuda_bindings/cuda/bindings/cyruntime.pyx.in
|
||||
@@ -2012,7 +2012,7 @@ cdef cudaError_t cudaGraphicsVDPAURegisterOutputSurface(cudaGraphicsResource** r
|
||||
{{if True}}
|
||||
|
||||
from libc.stdint cimport uintptr_t
|
||||
-from cuda.pathfinder import load_nvidia_dynamic_lib
|
||||
+from ctypes import CDLL
|
||||
{{if 'Windows' == platform.system()}}
|
||||
cimport cuda.bindings._lib.windll as windll
|
||||
{{else}}
|
||||
@@ -2022,11 +2022,11 @@ cimport cuda.bindings._lib.dlfcn as dlfcn
|
||||
cdef cudaError_t getLocalRuntimeVersion(int* runtimeVersion) except ?cudaErrorCallRequiresNewerDriver nogil:
|
||||
# Load
|
||||
with gil:
|
||||
- loaded_dl = load_nvidia_dynamic_lib("cudart")
|
||||
+ loaded_dl = CDLL("@libcudart@/lib/libcudart.so")
|
||||
{{if 'Windows' == platform.system()}}
|
||||
- handle = <uintptr_t>loaded_dl._handle_uint
|
||||
+ handle = <uintptr_t>loaded_dl._handle
|
||||
{{else}}
|
||||
- handle = <void *><uintptr_t>loaded_dl._handle_uint
|
||||
+ handle = <void *><uintptr_t>loaded_dl._handle
|
||||
{{endif}}
|
||||
|
||||
{{if 'Windows' == platform.system()}}
|
||||
@@ -0,0 +1,169 @@
|
||||
diff --git a/cuda_bindings/cuda/bindings/_bindings/cynvrtc.pyx.in b/cuda_bindings/cuda/bindings/_bindings/cynvrtc.pyx.in
|
||||
index 534dcb55cb..bd3feb2760 100644
|
||||
--- a/cuda_bindings/cuda/bindings/_bindings/cynvrtc.pyx.in
|
||||
+++ b/cuda_bindings/cuda/bindings/_bindings/cynvrtc.pyx.in
|
||||
@@ -8,7 +8,7 @@ cimport cuda.bindings._lib.windll as windll
|
||||
{{else}}
|
||||
cimport cuda.bindings._lib.dlfcn as dlfcn
|
||||
{{endif}}
|
||||
-from cuda.pathfinder import load_nvidia_dynamic_lib
|
||||
+from ctypes import CDLL
|
||||
from libc.stdint cimport intptr_t, uintptr_t
|
||||
import threading
|
||||
|
||||
@@ -47,7 +47,7 @@ cdef int _cuPythonInit() except -1 nogil:
|
||||
# Load library
|
||||
with gil, __symbol_lock:
|
||||
{{if 'Windows' == platform.system()}}
|
||||
- handle = load_nvidia_dynamic_lib("nvrtc")._handle_uint
|
||||
+ handle = CDLL("@libnvrtc@/lib/libnvrtc.so")._handle
|
||||
|
||||
# Load function
|
||||
{{if 'nvrtcGetErrorString' in found_functions}}
|
||||
@@ -156,7 +156,7 @@ cdef int _cuPythonInit() except -1 nogil:
|
||||
{{endif}}
|
||||
|
||||
{{else}}
|
||||
- handle = <void*><uintptr_t>(load_nvidia_dynamic_lib("nvrtc")._handle_uint)
|
||||
+ handle = <void*><uintptr_t>(CDLL("@libnvrtc@/lib/libnvrtc.so")._handle)
|
||||
|
||||
# Load function
|
||||
{{if 'nvrtcGetErrorString' in found_functions}}
|
||||
diff --git a/cuda_bindings/cuda/bindings/_internal/cufile_linux.pyx b/cuda_bindings/cuda/bindings/_internal/cufile_linux.pyx
|
||||
index 5231808058..f74cf1daec 100644
|
||||
--- a/cuda_bindings/cuda/bindings/_internal/cufile_linux.pyx
|
||||
+++ b/cuda_bindings/cuda/bindings/_internal/cufile_linux.pyx
|
||||
@@ -9,7 +9,7 @@ import threading
|
||||
|
||||
from .utils import FunctionNotFoundError, NotSupportedError
|
||||
|
||||
-from cuda.pathfinder import load_nvidia_dynamic_lib
|
||||
+from ctypes import CDLL
|
||||
|
||||
import cython
|
||||
|
||||
@@ -107,7 +107,7 @@ cdef void* __cuFileGetParameterPosixPoolSlabArray = NULL
|
||||
|
||||
|
||||
cdef void* load_library() except* with gil:
|
||||
- cdef uintptr_t handle = load_nvidia_dynamic_lib("cufile")._handle_uint
|
||||
+ cdef uintptr_t handle = CDLL("@libcufile@/lib/libcufile.so")._handle
|
||||
return <void*>handle
|
||||
|
||||
|
||||
diff --git a/cuda_bindings/cuda/bindings/_internal/nvfatbin_linux.pyx b/cuda_bindings/cuda/bindings/_internal/nvfatbin_linux.pyx
|
||||
index f5a9bbd218..8271f7aa20 100644
|
||||
--- a/cuda_bindings/cuda/bindings/_internal/nvfatbin_linux.pyx
|
||||
+++ b/cuda_bindings/cuda/bindings/_internal/nvfatbin_linux.pyx
|
||||
@@ -9,7 +9,7 @@ from libc.stdint cimport intptr_t, uintptr_t
|
||||
import threading
|
||||
from .utils import FunctionNotFoundError, NotSupportedError
|
||||
|
||||
-from cuda.pathfinder import load_nvidia_dynamic_lib
|
||||
+from ctypes import CDLL
|
||||
|
||||
|
||||
###############################################################################
|
||||
@@ -73,7 +73,7 @@ cdef void* __nvFatbinAddTileIR = NULL
|
||||
|
||||
|
||||
cdef void* load_library() except* with gil:
|
||||
- cdef uintptr_t handle = load_nvidia_dynamic_lib("nvfatbin")._handle_uint
|
||||
+ cdef uintptr_t handle = CDLL("@libnvfatbin@/lib/libnvfatbin.so")._handle
|
||||
return <void*>handle
|
||||
|
||||
|
||||
diff --git a/cuda_bindings/cuda/bindings/_internal/nvjitlink_linux.pyx b/cuda_bindings/cuda/bindings/_internal/nvjitlink_linux.pyx
|
||||
index d676aac372..ed3c000566 100644
|
||||
--- a/cuda_bindings/cuda/bindings/_internal/nvjitlink_linux.pyx
|
||||
+++ b/cuda_bindings/cuda/bindings/_internal/nvjitlink_linux.pyx
|
||||
@@ -9,7 +9,7 @@ from libc.stdint cimport intptr_t, uintptr_t
|
||||
import threading
|
||||
from .utils import FunctionNotFoundError, NotSupportedError
|
||||
|
||||
-from cuda.pathfinder import load_nvidia_dynamic_lib
|
||||
+from ctypes import CDLL
|
||||
|
||||
|
||||
###############################################################################
|
||||
@@ -76,7 +76,7 @@ cdef void* __nvJitLinkVersion = NULL
|
||||
|
||||
|
||||
cdef void* load_library() except* with gil:
|
||||
- cdef uintptr_t handle = load_nvidia_dynamic_lib("nvJitLink")._handle_uint
|
||||
+ cdef uintptr_t handle = CDLL("@libnvjitlink@/lib/libnvJitLink.so")._handle
|
||||
return <void*>handle
|
||||
|
||||
|
||||
diff --git a/cuda_bindings/cuda/bindings/_internal/nvml_linux.pyx b/cuda_bindings/cuda/bindings/_internal/nvml_linux.pyx
|
||||
index 28f0919423..852f75e46d 100644
|
||||
--- a/cuda_bindings/cuda/bindings/_internal/nvml_linux.pyx
|
||||
+++ b/cuda_bindings/cuda/bindings/_internal/nvml_linux.pyx
|
||||
@@ -10,7 +10,7 @@ import threading
|
||||
|
||||
from .utils import FunctionNotFoundError, NotSupportedError
|
||||
|
||||
-from cuda.pathfinder import load_nvidia_dynamic_lib
|
||||
+from ctypes import CDLL
|
||||
|
||||
|
||||
###############################################################################
|
||||
@@ -406,7 +406,7 @@ cdef void* __nvmlDeviceSetRusdSettings_v1 = NULL
|
||||
|
||||
|
||||
cdef void* load_library() except* with gil:
|
||||
- cdef uintptr_t handle = load_nvidia_dynamic_lib("nvml")._handle_uint
|
||||
+ cdef uintptr_t handle = CDLL("@libnvml@/lib/libnvidia-ml.so")._handle
|
||||
return <void*>handle
|
||||
|
||||
|
||||
diff --git a/cuda_bindings/cuda/bindings/_internal/nvvm_linux.pyx b/cuda_bindings/cuda/bindings/_internal/nvvm_linux.pyx
|
||||
index 8a84834a9a..a3ced66807 100644
|
||||
--- a/cuda_bindings/cuda/bindings/_internal/nvvm_linux.pyx
|
||||
+++ b/cuda_bindings/cuda/bindings/_internal/nvvm_linux.pyx
|
||||
@@ -9,7 +9,7 @@ from libc.stdint cimport intptr_t, uintptr_t
|
||||
import threading
|
||||
from .utils import FunctionNotFoundError, NotSupportedError
|
||||
|
||||
-from cuda.pathfinder import load_nvidia_dynamic_lib
|
||||
+from ctypes import CDLL
|
||||
|
||||
|
||||
###############################################################################
|
||||
@@ -75,7 +75,7 @@ cdef void* __nvvmGetProgramLog = NULL
|
||||
|
||||
|
||||
cdef void* load_library() except* with gil:
|
||||
- cdef uintptr_t handle = load_nvidia_dynamic_lib("nvvm")._handle_uint
|
||||
+ cdef uintptr_t handle = CDLL("@libnvvm@/lib/libnvvm.so")._handle
|
||||
return <void*>handle
|
||||
|
||||
|
||||
diff --git a/cuda_bindings/cuda/bindings/cyruntime.pyx.in b/cuda_bindings/cuda/bindings/cyruntime.pyx.in
|
||||
index 244410a382..769664e157 100644
|
||||
--- a/cuda_bindings/cuda/bindings/cyruntime.pyx.in
|
||||
+++ b/cuda_bindings/cuda/bindings/cyruntime.pyx.in
|
||||
@@ -2042,7 +2042,7 @@ cdef cudaError_t cudaGraphicsVDPAURegisterOutputSurface(cudaGraphicsResource** r
|
||||
{{if True}}
|
||||
|
||||
from libc.stdint cimport uintptr_t
|
||||
-from cuda.pathfinder import load_nvidia_dynamic_lib
|
||||
+from ctypes import CDLL
|
||||
{{if 'Windows' == platform.system()}}
|
||||
cimport cuda.bindings._lib.windll as windll
|
||||
{{else}}
|
||||
@@ -2052,11 +2052,11 @@ cimport cuda.bindings._lib.dlfcn as dlfcn
|
||||
cdef cudaError_t getLocalRuntimeVersion(int* runtimeVersion) except ?cudaErrorCallRequiresNewerDriver nogil:
|
||||
# Load
|
||||
with gil:
|
||||
- loaded_dl = load_nvidia_dynamic_lib("cudart")
|
||||
+ loaded_dl = CDLL("@libcudart@/lib/libcudart.so")
|
||||
{{if 'Windows' == platform.system()}}
|
||||
- handle = <uintptr_t>loaded_dl._handle_uint
|
||||
+ handle = <uintptr_t>loaded_dl._handle
|
||||
{{else}}
|
||||
- handle = <void *><uintptr_t>loaded_dl._handle_uint
|
||||
+ handle = <void *><uintptr_t>loaded_dl._handle
|
||||
{{endif}}
|
||||
|
||||
{{if 'Windows' == platform.system()}}
|
||||
Reference in New Issue
Block a user