Skip to content

Commit aa1b95c

Browse files
Hniii98inducer
authored andcommitted
Fix dll dir in CUDA 13.x
1 parent 9a1f321 commit aa1b95c

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

pycuda/driver.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,17 @@ def _search_on_path(filenames):
3131

3232

3333
def _add_cuda_libdir_to_dll_path():
34-
from os.path import dirname, join
34+
from os.path import dirname, exists, join
3535

3636
cuda_path = os.environ.get("CUDA_PATH")
3737

3838
if cuda_path is not None:
39-
os.add_dll_directory(join(cuda_path, "bin"))
39+
# CUDA 13.0+ use bin/x64/ as dir
40+
lib_dir = join(cuda_path, "bin", "x64")
41+
if exists(lib_dir):
42+
os.add_dll_directory(lib_dir)
43+
else:
44+
os.add_dll_directory(join(cuda_path, "bin"))
4045
return
4146

4247
nvcc_path = _search_on_path(["nvcc.exe"])

0 commit comments

Comments
 (0)