Do you know the steps, in "google colab", with Ubuntu 22.04, to downgrade the CUDA 12.2…
- User
Do you know the steps, in "google colab", with Ubuntu 22.04, to downgrade the CUDA 12.2 to CUDA 11.8 and cuDNN 8.6?
- Assistant
Do you know the steps, in "google colab", with Ubuntu 22.04, to downgrade the CUDA 12.2 to CUDA 11.8 and cuDNN 8.6?
Yes! If you're using Google Colab with Ubuntu 22.04 and you need to downgrade CUDA from version 12.2 to version 11.8, along with cuDNN to version 8.6, you can follow these general steps.
Note that Google Colab typically uses a pre-installed CUDA version, so the usual way to downgrade CUDA is to uninstall the existing version and install the desired one. Here is a step-by-step guide to achieve this:
Check current CUDA and cuDNN versions:
First, you can check the current CUDA and cuDNN versions. Run the following commands:
!nvcc --version
!cat /usr/include/cudnn_version.h | grep CUDNN_MAJOR -A 2
Uninstall the current CUDA:
You need to remove the installed CUDA version:
!apt-get --yes purge cuda
Install CUDA 11.8:
Now, you can install CUDA 11.8. You can do this directly from the NVIDIA repository. First, add the NVIDIA package repository and then install:
!apt-get update
!apt-get install -y wget
!wget https://developer.download.nvidia.com/compute/cuda/11.8.0/local_installers/cuda-repo-ubuntu2204-11-8-local_11.8.0-1_amd64.deb
!dpkg -i cuda-repo-ubuntu2204-11-8-local_11.8.0-1_amd64.deb
!apt-key add /var/cuda-repo-ubuntu2204-11-8-local/7fa2af80.pub
!apt-get update
!apt-get install -y cuda-11-8
Set environment variables:
Update the environment variables to point to the newly installed CUDA version. You may want to add the following lines to your .bashrc or execute them directly in your notebook:
import os
os.environ['CUDA_HOME'] = "/usr/local/cuda-11.8"
os.environ['PATH'] += ":/usr/local/cuda-11.8/bin"
os.environ['LD_LIBRARY_PATH'] += ":/usr/local/cuda-11.8/lib64"
Install cuDNN 8.6:
Download and install cuDNN corresponding to CUDA 11.8. You would typically download cuDNN from NVIDIA's cuDNN page (you will need an NVIDIA account). However, as Colab does not allow direct internet downloads in a conventional sense, you can use:
!apt-get install libcudnn8=8.6.0.*-1+cuda11.8
Verify installation:
Check whether CUDA and cuDNN were properly installed:
!nvcc --version
!cat /usr/include/cudnn_version.h | grep CUDNN_MAJOR -A 2
Restart Runtime:
After performing these changes, make sure to restart the runtime for the path changes and installations to take effect.
This process heavily relies on direct installations and package management, which might not always be straightforward in a Colab environment. Changes to the base OS (like Ubuntu) files may be overwritten when Colab updates its environment. Additionally, if you face any issues, consider targeting a specific runtime version that supports the desired CUDA and cuDNN versions instead.
If you find any errors during the process, please check the specific version compatibility or dependencies as needed.