How to retrieve CUDA and cuDNN versions.

Please note that the CUDA version in nvidia-smi does not show the currently installed CUDA version. Instead, it shows the highest CUDA version supported by your current installed NVIDIA graphics card driver.

NVIDIA Docker Container

Take a docker container (nvcr.io/nvidia/pytorch:20.12-py3) as example.

root@ubuntu:/# echo $CUDA_VERSION
11.1.1.002
root@ubuntu:/# echo $CUDNN_VERSION
8.0.5.43

Other NVIDIA SDK versions in other containers such as:

root@ubuntu:/# echo $TENSORRT_VERSION
8.2.3

PyTorch

root@ubuntu:/# python -c "import torch; print(torch.version.cuda)"
11.1
root@ubuntu:/# python -c "import torch; print(torch.backends.cudnn.version())"
8005

Updated:

Posted: