Cuda 10.0 & Cudnn7 Installation — Where AI evolves from crawling to running

Alex Yeo
2 min readJul 4, 2020

--

After few days of frustration in installing Cuda and Cudnn, I decided to write a blog listing down the steps so that you can escape the frustration that I have gone through.

One Important thing : Do not restart your computer in the middle of installation!

Have you seen this “apt — fix-broken” error ? No worry! this blog will guide you through with explanation.

Let’s start !!!

First, let’s remove the other version of Cuda

sudo apt — fix-broken installsudo dpkg — configure -asudo apt-get cleandpkg -l | grep cuda- | awk ‘{print $2}’ | xargs -n1 sudo dpkg — purgesudo apt-get purge nvidia*sudo apt-get -f installsudo apt autoremovesudo apt — purge remove “cublas*” “cuda*”sudo apt — purge remove “nvidia*”

Then, download Cuda 10.0

wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-repo-ubuntu1804_10.0.130-1_amd64.debsudo apt-key adv — fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/7fa2af80.pub && sudo apt updatesudo dpkg -i cuda-repo-ubuntu1804_10.0.130–1_amd64.deb

Install Cuda

sudo apt update
sudo apt install -y cuda-10-0

Download Cudnn 7

wget https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64/nvidia-machine-learning-repo-ubuntu1804_1.0.0-1_amd64.debsudo dpkg -i nvidia-machine-learning-repo-ubuntu1804_1.0.0–1_amd64.deb

Install Cudnn 7

sudo apt update
sudo apt install -y libcudnn7 libcudnn7-dev libnccl2 libc-ares-dev

Remove the not required dependencies

sudo apt autoremove
sudo apt upgrade

Link libraries to appropriate location

sudo mkdir -p /usr/local/cuda-10.0/nccl/libsudo ln -s /usr/lib/x86_64-linux-gnu/libnccl.so.2 /usr/local/cuda-10.0/nccl/lib/sudo ln -s /usr/lib/x86_64-linux-gnu/libcudnn.so.7 /usr/local/cuda-10.0/lib64/

When you reach here without error message, feel free to restart your computer.

After that, you can check whether your tensorflow library is capable of calling the installed Cuda.

pip3 install tensorflow-gpu==1.15.2

Open terminal and type these few commands :

pythonimport tensorflow as tftf.Session()

You will see “successfully open …”. This means that the Cuda library is successfully installed and you can start training your deep learning models.

--

--

No responses yet