I have stumbled upon many guides to install deep learning libraries, Cuda, cuDNN & nvidia-driver. But I have never been successful in one go following only one guide. So, I decided to write this article. First, this guide is to install deep learning libraries ( TensorFlow, Keras, PyTorch) with GPU support. CPU support is pretty straight-forward, so I won’t be talking about that.
You need a
NVIDIA® GPU card with CUDA® Compute Capability 3.5 or higher.
You can check whether your GPU is compatible or not by visiting this link.
Run these following commands. It adds the necessary repository to download the Nvidia driver. It will
sudo add-apt-repository ppa:graphic-drivers/ppa
sudo apt update
ubuntu-drivers devices | grep nvidia
It will show you the driver versions compatible with your GPU card. I have an RTX 2060 super GPU card. It shows
driver : nvidia-430 — third-party free recommended
It may also show multiple entries depending on the GPU card you are using. Example
driver : nvidia-340 — distro non-free
driver : nvidia-304 — distro non-free
driver : nvidia-384 — distro non-free recommended
Install the suitable version. Your driver will decide the minimum version of CUDA you are going to install. You can find the table here.
sudo apt install nvidia-xxx
Repace xxx
with your desired version. Reboot and check the installation
sudo reboot
lsmod|grep nvidia
nvidia-smi
#cuda #cudnn #ubuntu #tensorflow #nvidia-driver