Conversation
4c9ac00 to
272a904
Compare
|
Thanks, this looks reasonable. I'll roll a new release, just in case. |
|
Thanks for reviewing so fast! By the way, this is my first merged PR in the open-source world. Hope everything is done right. |
Root Cause and ExplanationIn Python 3.8, the behavior for DLL loading has changed. For more details, refer to: What's New in Python 3.8
CUDA and PyCUDA CompatibilityBefore CUDA 13.0, all CUDA-related DLLs were located in the $CUDA_PATH/bin directory. This setup worked perfectly with the older DLL loading behavior in PyCUDA. The code looked like this: cuda_path = os.environ.get("CUDA_PATH")
if cuda_path is not None:
os.add_dll_directory(join(cuda_path, "bin"))
returnHowever, starting with CUDA 13.x (13.1.0/13.0.2/13.0.1/13.0.0), NVIDIA changed the directory structure, moving the DLL files to $CUDA_PATH/bin/x64. This change, combined with the new DLL loading behavior introduced in Python 3.8+, means that even if you add $CUDA_PATH/bin/x64 to the $PATH environment variable, it will not solve the issue, as Python no longer uses $PATH to resolve DLLs. SolutionTo resolve the issue, explicitly add $CUDA_PATH/bin/x64 using os.add_dll_directory() if the directory exists. Future RisksIf NVIDIA changes the DLL directory structure again in future CUDA releases, this issue may recur. PyCUDA might fail to locate the necessary DLLs until the new path is explicitly added using os.add_dll_directory(). |
#497