Open MahmoudAshraf97 opened 1 month ago
Update: it's compatible with torch==2.*+cu124
so it's only incompatible with 12.1, I'll open a PR to solve this
Thanks to me and my analysis here...I want full citation and credit please: ;-)
https://github.com/SYSTRAN/faster-whisper/pull/1082#issuecomment-2434841285
@MahmoudAshraf97 let me know if you need to know how I prefer citations to my contributions made please. Thanks.
@BBC-Esq
Thank you for the list of compatible versions. I have the following versions installed in a Docker container, but I still get the cuDNN error. Am I missing something?
OS: Debian GNU/Linux 12 (bookworm)
nvidia-smi:
NVIDIA RTX 4500 Ada Gene...
NVIDIA-SMI 560.35.03
Driver Version: 560.35.03
CUDA Version: 12.6
Name: torch Version: 2.5.0
Name: ctranslate2 Version: 4.5.0
Name: nvidia-cudnn-cu12 Version: 9.1.0.70
Name: nvidia-cuda-cupti-cu12 Version: 12.4.127
Name: nvidia-cublas-cu12 Version: 12.4.5.8
Name: nvidia-cuda-runtime-cu12 Version: 12.4.127
which cudnn error are you getting exactly?
@MahmoudAshraf97 Exactly the same as in https://github.com/OpenNMT/CTranslate2/issues/1806#issue-2610861176
@MarkusGehrig Can you try ldconfig -p | grep cudnn_cnn
to verify the location of cudnn_cnn lib?
If you found the lib, you can check if this lib is in the runtime search path. If not, try to add it into LD_LIBRARY_PATH and see what happens.
Thanks for the quick response. But I still get the error.
Unable to load any of {libcudnn_cnn.so.9.1.0, libcudnn_cnn.so.9.1, libcudnn_cnn.so.9, libcudnn_cnn.so}
Invalid handle. Cannot load symbol cudnnCreateConvolutionDescriptor
Aborted (core dumped)
ldconfig -p | grep cudnn_cnn libcudnn_cnn.so.9 (libc6,x86-64) => /lib/x86_64-linux-gnu/libcudnn_cnn.so.9 libcudnn_cnn.so (libc6,x86-64) => /lib/x86_64-linux-gnu/libcudnn_cnn.so
printenv LD_LIBRARY_PATH /lib/x86_64-linux-gnu/libcudnn_cnn.so.9
I also have tried to install it with pip, with no change.
Try to set only LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/lib/x86_64-linux-gnu/
.
And what is the result of this: nm -gD /lib/x86_64-linux-gnu/libcudnn_cnn.so | grep cudnnCreateConvolutionDescriptor
?
@minhthuc2502
It works like a charm now. It was a path that needed to be set to LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/lib/x86_64-linux-gnu/
Thanks!
For everybody's future reference, to investigate possible compatibility issues with other CUDA libraries or platforms in general, you can go here. In the lower left you can select the cuDNN version and it will bring up a page that explains all the nuances:
https://docs.nvidia.com/deeplearning/cudnn/v9.1.1/reference/support-matrix.html
This might help troubleshooting based on platform, etc.
Also, if you need to correlate what version of cuDNN you have you can go to either of these places:
https://developer.download.nvidia.com/compute/cudnn/redist/cudnn/ https://pypi.org/project/nvidia-cudnn-cu12/#history
I noticed that this still says it's using CUDA 12.2 while at the same time using cuDNN 9.1? Prior to 4.5.0, it was cuDNN 8.8.0 and CUDA 12.2?
https://github.com/OpenNMT/CTranslate2/blob/master/python/tools/prepare_build_environment_windows.sh
I'm guessing that's because CUDA 12.2 is compatible with cuDNN 8.8.0 still? However, Ctranslate2 4.5.0+ requires cuDNN 9.1 and is only compatible with CUDA 12.4. (assuming you're also using torch, which only has builds for 12.1 and 12.4).
Not sure if it's redundant because I already posted on faster-whisper
, but here is the compatibility outline just FYI:
Ctranslate2 3.24.0 - last to use cuDNN 8.1.1 with CUDA 11.2.2 by default Ctranslate2 4.0.0 - first to use cuDNN 8.8.0 with CUDA 12.2 by default Ctranslate2 4.5.0 - first to use cuDNN 9.1 with CUDA 12.2 by default
torch 2.5.0 - supports CUDA 11.8, 12.1, and 12.4 torch 2.4.1 - supports CUDA 11.8, 12.1, and 12.4 torch 2.4.0 - supports CUDA 11.8, 12.1, and 12.4 torch 2.3.1 - supports CUDA 11.8 and 12.1 torch 2.2.2 - supports CUDA 11.8 and 12.1
cuDNN 8.9.7 supports CUDA 11 through 12.2 cuDNN 9.0.0 - " " through 12.3 ~~cuDNN 9.1.0 - " " through 12.4 cuDNN 9.1.1 - " " through 12.4 cuDNN 9.2.0 - " " through 12.5 cuDNN 9.2.1 - " " through 12.5 cuDNN 9.3.0 - " " through 12.6 cuDNN 9.4.0 - " " through 12.6 cuDNN 9.5.0 - " " through 12.6~~
Beginning with cuDNN 9.1.0 I believe that cuDNN in general is forward compatible with CUDA 12.x Here are my sources:
https://docs.nvidia.com/deeplearning/cudnn/v9.1.0/release-notes.html#cudnn-9-1-0
https://docs.nvidia.com/deeplearning/cudnn/v9.1.0/reference/support-matrix.html
Regardless...right now...unless you're using ctranslate2
without torch
, you're essentially limited to using CUDA 12.4 since torch
doesn't make wheels for higher than 12.4 yet. In other words, even though cuDNN
might be compatible with future version of CUDA 12.x, it's my understanding that torch
specifically names their wheels as only being compatible with a specific CUDA version - e.g. cu121
or cu124
.
torch
wheel named cu124
. Even the 0.0.x version difference might be breaking depending on what you are using the libraries for...Does anyone else know?This causes problems because most people will probably download the most recent CUDA toolkit because "newer must mean better..."
For the same case with google colab users . @MahmoudAshraf97 Could you check if with torch==2.5.0+cu12.1
, you can find this lib at /usr/local/lib/python3.10/dist-packages/nvidia/cudnn/lib/libcudnn_cnn.so.9
? You can try to add to LD_LIBRARY_PATH with this path /usr/local/lib/python3.10/dist-packages/nvidia/cudnn/lib/
FYI, cudnn 9 should be compatible with all cuda version, see here. It's weird that it does not work with some torch's versions . In my opinion, it could be the problem of finding path.
apparently there are two cudnn versions installed in colab
ldconfig -p | grep cudnn_cnn
libcudnn_cnn_train.so.8 (libc6,x86-64) => /lib/x86_64-linux-gnu/libcudnn_cnn_train.so.8
libcudnn_cnn_train.so (libc6,x86-64) => /lib/x86_64-linux-gnu/libcudnn_cnn_train.so
libcudnn_cnn_infer.so.8 (libc6,x86-64) => /lib/x86_64-linux-gnu/libcudnn_cnn_infer.so.8
libcudnn_cnn_infer.so (libc6,x86-64) => /lib/x86_64-linux-gnu/libcudnn_cnn_infer.so
pip show nvidia-cudnn-cu12
Name: nvidia-cudnn-cu12
Version: 9.5.0.50
Summary: cuDNN runtime libraries
Home-page: https://developer.nvidia.com/cuda-zone
Author: Nvidia CUDA Installer Team
Author-email: [compute_installer@nvidia.com](mailto:compute_installer@nvidia.com)
License: NVIDIA Proprietary Software
Location: /usr/local/lib/python3.10/dist-packages
Requires: nvidia-cublas-cu12
Required-by:
adding the pip cudnn path to LD_LIBRARY_PATH
will probably solve the problem
torch is using the v9 pip installation and ignoring the v8 while ctranslate2
is looking for v9 in the v8 installation path
probably the best way forward is to make CT2 compatible with pip CUDA libraries without needing to modify the path
@BBC-Esq the problem here is not a cuda vs cudnn compatibility because as per the compatibility matrix we should not be having this issue, it's an environment setup issue that might involve a mismatch between cuda/cudnn pathes CT2 should support all cuda 12 versions CT2 >=4.5 should support all cudnn 9 versions along with cuda 12, any difference in the minor or patch versions should not break compatibility
@BBC-Esq the problem here is not a cuda vs cudnn compatibility because as per the compatibility matrix we should not be having this issue, it's an environment setup issue that might involve a mismatch between cuda/cudnn pathes CT2 should support all cuda 12 versions CT2 >=4.5 should support all cudnn 9 versions along with cuda 12, any difference in the minor or patch versions should not break compatibility
I partially understand I think...Will ponder further...In the meantime...you mentioned possibly using the pip CUDA libraries...
I spent the time to aggregate the versions of ALL CUDA-RELATED LIBRARIES on pypi.org by Nvidia release. Here are the versions of all such libraries organized by CUDA Toolkit official Release Number:
These libraries, while available in the .exe
installer, are not available on pypi.org, but shouldn't be needed for ctranslate2
anyways:
cuda_cuobjdump
cuda_nvdisasm
cuda_nvprune
cuda_nvprof
cuda_nvvp
nsight_compute
nsight_vse
nvidia_driver (Windows Driver)
With that being said, you might also consider this script or a modification of it...I'm still customizing it for my own program, actually. Here's the script:
https://github.com/NVIDIA/build-system-archive-import-examples/blob/main/parse_redist.py
Anyhow...I am confident in this versioning...I downloaded all official releases as seen here:
I inspected all files that the installer extracts to a temporary directory...there is always a "version.json" file within a sub-folder named "CUDAToolkit" that contains the correlating versions. Here is a brief excerpt of one such file. The version numbers ALWAYS correlate to the versions list on pypi.org. Moreover, they ALWAYS correlate to "distributables" on Nvidia's website.
@MahmoudAshraf97 please note...you use the pip
method, you will NOT get binaries like nvcc.exe
(just to give one example) that ARE installed when using the .exe
installer. Using nvcc
as an example, nvcc
via pip
gives, you within the bin
folder, the following:
If you use the aforementioned download script, however, you will get:
This could make a difference if, for example, ctranslate2
relies on such files. I encountered this issue when trying to use the pip
installation method with the triton
library (which my program needs) because triton
needs nvcc.exe
...this is but one example.
In the meantime, pursuant to our discussion, I've created a script that will download that appropriate CUDA Toolkit files (by version) or you can choose to download the cuDNN files. Remember, you must still set the appropriate PATH and other variables...and you must still make sure that the cuDNN version you're using is compatible with cuDNN and/or Torch and/or Ctranslate2 and/or any other library you plan to use in your program.
You will only need to pip install pyside6
above and beyond the standard python libraries used. You should name this script download_cuda.py
.
Official compatibility matrix that I found at:
https://github.com/pytorch/pytorch/blob/main/RELEASE.md#release-compatibility-matrix
PyTorch version | Python | C++ | Stable CUDA | Experimental CUDA | Stable ROCm |
---|---|---|---|---|---|
2.5 | >=3.9, <=3.12, (3.13 experimental) | C++17 | CUDA 11.8, CUDA 12.1, CUDA 12.4, CUDNN 9.1.0.70 | None | ROCm 6.2 |
2.4 | >=3.8, <=3.12 | C++17 | CUDA 11.8, CUDA 12.1, CUDNN 9.1.0.70 | CUDA 12.4, CUDNN 9.1.0.70 | ROCm 6.1 |
2.3 | >=3.8, <=3.11, (3.12 experimental) | C++17 | CUDA 11.8, CUDNN 8.7.0.84 | CUDA 12.1, CUDNN 8.9.2.26 | ROCm 6.0 |
2.2 | >=3.8, <=3.11, (3.12 experimental) | C++17 | CUDA 11.8, CUDNN 8.7.0.84 | CUDA 12.1, CUDNN 8.9.2.26 | ROCm 5.7 |
2.1 | >=3.8, <=3.11 | C++17 | CUDA 11.8, CUDNN 8.7.0.84 | CUDA 12.1, CUDNN 8.9.2.26 | ROCm 5.6 |
2.0 | >=3.8, <=3.11 | C++14 | CUDA 11.7, CUDNN 8.5.0.96 | CUDA 11.8, CUDNN 8.7.0.84 | ROCm 5.4 |
1.13 | >=3.7, <=3.10 | C++14 | CUDA 11.6, CUDNN 8.3.2.44 | CUDA 11.7, CUDNN 8.5.0.96 | ROCm 5.2 |
1.12 | >=3.7, <=3.10 | C++14 | CUDA 11.3, CUDNN 8.3.2.44 | CUDA 11.6, CUDNN 8.3.2.44 | ROCm 5.0 |
Hello, I’m running WhisperX on Databricks and encountering the same error:
Unable to load any of {libcudnn_cnn.so.9.1.0, libcudnn_cnn.so.9.1, libcudnn_cnn.so.9, libcudnn_cnn.so}
Invalid handle. Cannot load symbol cudnnCreateConvolutionDescriptor
Databricks Cluster Runtime: 15.4.x-gpu-ml-scala2.12
Packages - version:
whisperx - 3.1.5
torch - 2.5.1+cu124
ctranslate2 - 4.5.0
nvidia-cublas-cu12 - 12.4.5.8
nvidia-cuda-cupti-cu12 - 12.4.127
nvidia-cuda-nvrtc-cu12 - 12.4.127
nvidia-cuda-runtime-cu12 - 12.4.127
nvidia-cudnn-cu12 - 9.1.0.70
nvidia-cufft-cu12 - 11.2.1.3
nvidia-curand-cu12 - 10.3.5.147
nvidia-cusolver-cu12 - 11.6.1.9
nvidia-cusparse-cu12 - 12.3.1.170
nvidia-ml-py - 12.555.43
nvidia-nccl-cu12 - 2.21.5
nvidia-nvjitlink-cu12 - 12.4.127
nvidia-nvtx-cu12 - 12.4.127
pip show nvidia-cudnn-cu12
Name: nvidia-cudnn-cu12
Version: 9.1.0.70
Summary: cuDNN runtime libraries
Home-page: https://developer.nvidia.com/cuda-zone
Author: Nvidia CUDA Installer Team
Author-email: cuda_installer@nvidia.com
License: NVIDIA Proprietary Software
Location: /local_disk0/.ephemeral_nfs/cluster_libraries/python/lib/python3.11/site-packages
Requires: nvidia-cublas-cu12
Required-by: torch
!ldconfig -p | grep cudnn_cnn
libcudnn_cnn_train.so.8 (libc6,x86-64) => /lib/x86_64-linux-gnu/libcudnn_cnn_train.so.8
libcudnn_cnn_infer.so.8 (libc6,x86-64) => /lib/x86_64-linux-gnu/libcudnn_cnn_infer.so.8
I’ve tried running:
!export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/lib/x86_64-linux-gnu/
But there was no change. Could someone help me here? I’ve been trying to find a solution for almost a week.
Here is an ongoing updated .txt that I've been working on if it helps...
If your situation involves having to set PATH and what not, however, I'm afraid I can't help there. I'm on Windows...
ctranslate2==2.5.0
is currently built with cudnn
release 9.1, which the the equivalent of pip install nvidia-cudnn-cu12==9.1.0.70
if you use pip...
Also, it's built with CUDA 12.2 in mind, which is seen here...
https://github.com/OpenNMT/CTranslate2/blob/master/python/tools/prepare_build_environment_linux.sh
Here is what AI says when I fed it your question and my matrices...
You'll have to analyze all of this because that's as far as I've gotten. Hope it helps...
I was having this issue with CUDA 12.4.1 and Torch 2.5.1. It was resolved by manually setting LD_LIBRARY_PATH, but why is that necessary? Under normal circumstances I would expect it to find the lib automatically
Because now that torch
bundles the CUDA .dll files, essentially, it is also setting paths to them in the "torch" source code somewhere. I scoured the source code a few weeks ago and found it...and the paths vary by which version of torch your install (i.e. what platform the wheel is for)...but essentially that's what's going on. That's as far as I got, however, since I had to turn to real world work things...
Ctranslate2 is not the only ones experiencing frustration with how Torch is doing things...
Hello the last release works great with versions of pytorch that use python cuda packages, but when torch that is precompiled with cuda binaries is installed, this error appears:
the only solution so far is to downgrade to 4.4.0 although CuDNN v9.1 is installed both using pip and bundled with pytorch https://github.com/jhj0517/Whisper-WebUI/pull/348
ctranslate2>=4.5.0
uses CuDNN v9 which requires CUDA >= 12.3. Since most issues occur from a conflictingtorch
andctranslate2
installations these are tested working combinations:2.*.*+cu121
<=4.4.0
2.*.*+cu124
>=4.5.0
>=2.4.0
>=4.5.0
<2.4.0
<4.5.0
For google colab users, the quick solution is to downgrade to
4.4.0
as of 24/10/2024 as colab usestorch==2.5.0+cu12.1