5

I require to run tensorflow-gpu of version 1.3.0. For that, I need to downgrade cuda to version 8. Can someone please share the code to downgrade cuda in google colab from 10.0 to 8.0.

I got the code for downgrading to version 9 using this.

!wget https://developer.nvidia.com/compute/cuda/9.0/Prod/local_installers/cuda-repo-ubuntu1604-9-0-local_9.0.176-1_amd64-deb
!dpkg -i cuda-repo-ubuntu1604-9-0-local_9.0.176-1_amd64-deb
!apt-key add /var/cuda-repo-9-0-local/7fa2af80.pub
!apt-get update
!apt-get install cuda=9.0.176-1

I tried to change 9 in the code to 8 but that didn't work.

talonmies
  • 70,661
  • 34
  • 192
  • 269
R Kumar
  • 471
  • 1
  • 6
  • 6

3 Answers3

4

I also had to set up my system to use CUDA 8 and cuDNN 6. As you have pointed out, you have to first install CUDA. Afterwards, install cuDNN.

You can get the URL of the CUDA Installer that suits your operating system / target platform by visiting CUDA Toolkit Archive - CUDA Toolkit 8.0 - Feb 2017. Make sure you have an NVIDIA developer account before visiting the NVIDIA developer site.

To get the CUDA Installer for Linux Ubuntu 16.04 x86_64 you can use:

!wget https://developer.nvidia.com/compute/cuda/8.0/Prod2/local_installers/cuda-repo-ubuntu1604-8-0-local-ga2_8.0.61-1_amd64-deb
!dpkg -i cuda-repo-ubuntu1604-8-0-local-ga2_8.0.61-1_amd64-deb

!apt-key add /var/cuda-repo-8-0-local-ga2/7fa2af80.pub
!apt-get update
!apt-get install cuda=8.0.61-1
!apt autoremove

To install NVIDIA cuDNN you must have a NVIDIA developer account. After logging in with you credentials on the NVIDIA developer site, open the NVIDA cuDNN archive, where you can find cuDNN v1 to v7.6.4 at the moment. Now, click on the entry for "Download cuDNN v6.0 (April 27, 2017), for CUDA 8.0". To download cuDNN for Ubuntu 16.04, click on "cuDNN v6.0 Runtime Library for Ubuntu16.04 (Deb)". You can follow the direct link to cuDNN v6.0 Runtime Library for Ubuntu16.04 (Deb), but make sure you are logged into your NVIDIA developer account first.

Added the following paragraph on 2020-09-18: I do not provide a script to download NVIDIA cuDNN directly using Google Colab here. You could download NVIDIA cuDNN to your local system and upload it to Google Colab via Google Drive, for instance, mount your Google Drive and then install it with the already provided command below.

Here is an example script:

# Download NVIDIA cuDNN after logging in with your NVIDIA developer account
# https://developer.nvidia.com/rdp/cudnn-archive
# Select "Download cuDNN v6.0 (April 27, 2017), for CUDA 8.0"
# Download "cuDNN v6.0 Runtime Library for Ubuntu16.04 (Deb)" 
# Directlink (requires NVIDIA developer session):
# https://developer.nvidia.com/compute/machine-learning/cudnn/secure/v6/prod/8.0_20170307/Ubuntu16_04_x64/libcudnn6_6.0.20-1+cuda8.0_amd64-deb
# After downloading, install cuDNN
!dpkg -i "~/Downloads/libcudnn6_6.0.21-1+cuda8.0_amd64.deb"
# Check if package has been installed
!ls -l /usr/lib/x86_64-linux-gnu/libcudnn.so.6*

This should output for example:

Preparing to unpack .../libcudnn6_6.0.21-1+cuda8.0_amd64.deb ...
Unpacking libcudnn6 (6.0.21-1+cuda8.0) ...
Setting up libcudnn6 (6.0.21-1+cuda8.0) ...
Processing triggers for libc-bin (2.27-3ubuntu1) ...
lrwxrwxrwx 1 root root        18 Apr 12  2017 /usr/lib/x86_64-linux-gnu/libcudnn.so.6 -> libcudnn.so.6.0.21
-rw-r--r-- 1 root root 154322864 Apr 12  2017 /usr/lib/x86_64-linux-gnu/libcudnn.so.6.0.21

To clarify my answer, I also added webpage screenshots below for you.

Download NVIDIA CUDA Toolkit 8.0 - Feb 2017 - Webpage Screenshot

Download NVIDIA cuDNN v6.0 (April 27, 2017), for CUDA 8.0 - Webpage Screenshot

Bernhard
  • 703
  • 5
  • 25
  • 2
    The question asked for a way to do it on Google's colab, not on your local system.. – NFL Sep 17 '20 at 06:49
  • @NFL the scripts provided are already intended to be used on Google Colab, with exception of the download of NVIDIA cuDNN. You must have an NVIDIA developer account to download NVIDIA cuDNN and must sign-in. You are right in that I did not provide a command to download cuDNN therefore. You could download cuDNN to your local system and uploaded it to Google Colab via Google Drive, for instance, mount your Google Drive and then install it with the already provided command. I will clarify that in my answer. I hope that helps. :-) – Bernhard Sep 18 '20 at 08:10
  • Good on you for updating the parent comment. I just stumbled upon this post yesterday when I did exactly what you described earlier :) However installing it from the drive had given me a `/lib/libmkldnn.so.0 is not a symbolic link` error and I hoped this post would provide a way around that. Either way, your comment has all the steps required for someone getting started. Maybe my personal error is due to something else. Cheers. – NFL Sep 18 '20 at 15:19
  • @NFL Well, I did not recognize it until you mentioned this error in your comment, but I also have this error after installing NVIDIA CUDA and cuDNN in the install log. `/sbin/ldconfig.real: /usr/local/lib/python3.6/dist-packages/ideep4py/lib/libmkldnn.so.0 is not a symbolic link`. However, my PyTorch project has not been bothered by this error. Have you tried ignoring the error, carry on installing required dependencies for your project and experiment if it works? – Bernhard Sep 21 '20 at 14:05
1

To downgrade from 10.x to 10.0 this should help:

#Uninstall the current CUDA version
!apt-get --purge remove cuda nvidia* libnvidia-*
!dpkg -l | grep cuda- | awk '{print $2}' | xargs -n1 dpkg --purge
!apt-get remove cuda-*
!apt autoremove
!apt-get update

#Download CUDA 10.0
!wget  --no-clobber https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-repo-ubuntu1804_10.0.130-1_amd64.deb
#install CUDA kit dpkg
!dpkg -i cuda-repo-ubuntu1804_10.0.130-1_amd64.deb
!sudo apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/7fa2af80.pub
!apt-get update
!apt-get install cuda-10-0

found here: http://aconcaguasci.blogspot.com/2019/12/setting-up-cuda-100-for-mxnet-on-google.html

Mi Be
  • 431
  • 8
  • 18
0

I got the answer for downgrading cuda to version 8.0 using the following command line.

!wget https://developer.nvidia.com/compute/cuda/8.0/Prod2/local_installers/cuda-repo-ubuntu1604-8-0-local-ga2_8.0.61-1_amd64-deb
!dpkg -i cuda-repo-ubuntu1604-8-0-local-ga2_8.0.61-1_amd64-deb
!apt-get update
!apt-get install cuda=8.0.61-1

But another requirement is to downgrade the cuDNN version to 6.0. Can someone please give me the set of codes to downgrade cuDNN version to 6.0 in Google colab.

R Kumar
  • 471
  • 1
  • 6
  • 6
  • @R Kumar I updated my answer, to explain why I did not provided scripts for downloading NVIDIA cuDNN to version 6. It's because you must be logged-in to your personal NVIDIA developer account, to be able to download NVIDIA cuDNN. I cannot provide a simple command for just downloading and installing it in Google Colab. As stated, you could download NVIDIA cuDNN manually to your local computer, upload it to Google Colab (e.g. using Google Drive), and install NVIDIA cuDNN using the provided install command in my answer. You can find the URL to NVIDIA cuDNN download page in my answer already. – Bernhard Sep 18 '20 at 08:36