Colab中降级Cuda和cuDNN版本

Colab中降级Cuda和cuDNN版本

本文介绍了如何在Google Colab中降级Cuda和cuDNN版本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要运行版本1.3.0的tensorflow-gpu.为此,我需要将cuda降级到版本8.有人可以分享代码以将Google colab中的cuda降级到10.0到8.0.

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.

我得到了使用此代码降级到版本9的代码.

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

我试图将代码中的9更改为8,但这没用.

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

推荐答案

我还必须设置系统以使用CUDA 8和cuDNN 6.如您所指出的,您必须首先安装CUDA.然后,安装cuDNN.

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.

您可以访问 CUDA工具包存档-CUDA工具包8.0-2017年2月.在访问 NVIDIA开发人员网站之前,请确保您拥有NVIDIA开发人员帐户.

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.

要获取用于 Linux Ubuntu 16.04 x86_64 的CUDA安装程序,可以使用:

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

要安装 NVIDIA cuDNN ,您必须具有NVIDIA开发人员帐户.在NVIDIA开发人员网站上使用凭据登录后,打开 NVIDA cuDNN存档,您现在可以在其中找到cuDNN v1至v7.6.4.现在,单击下载CUDNN v6.0(2017年4月27日),适用于CUDA 8.0"的条目.要下载适用于Ubuntu 16.04的cuDNN,请单击适用于Ubuntu16.04(Deb)的cuDNN v6.0运行时库".您可以遵循直接链接到适用于Ubuntu16.04(Deb)的cuDNN v6.0运行时库,但请确保您先登录了NVIDIA开发人员帐户.

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.

在2020-09-18添加了以下段落:在这里,我没有提供直接使用Google Colab直接下载NVIDIA cuDNN的脚本.您可以将NVIDIA cuDNN下载到本地系统,然后通过Google云端硬盘将其上传到Google Colab,例如,安装Google云端硬盘,然后使用下面已经提供的命令进行安装.

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.

这是一个示例脚本:

# 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*

这应该输出例如:

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.

这篇关于如何在Google Colab中降级Cuda和cuDNN版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-25 12:15