将Colab上的CUDA版本降级到9
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了将Colab上的CUDA版本降级到9相关的知识,希望对你有一定的参考价值。
[尝试在Google Colab上运行存储库时,出现以下错误:
torch.__version__ = 1.0.0.dev20190328
setup.py:46: UserWarning: Option --pyprof not specified. Not installing PyProf dependencies!
warnings.warn("Option --pyprof not specified. Not installing PyProf dependencies!")
Compiling cuda extensions with
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2019 NVIDIA Corporation
Built on Wed_Oct_23_19:24:38_PDT_2019
Cuda compilation tools, release 10.2, V10.2.89
from /usr/local/cuda/bin
Traceback (most recent call last):
File "setup.py", line 106, in <module>
check_cuda_torch_binary_vs_bare_metal(torch.utils.cpp_extension.CUDA_HOME)
File "setup.py", line 80, in check_cuda_torch_binary_vs_bare_metal
"https://github.com/NVIDIA/apex/pull/323#discussion_r287021798. "
RuntimeError: Cuda extensions are being compiled with a version of Cuda that does not match the version used to compile Pytorch binaries. Pytorch binaries were compiled with Cuda 9.0.176.
In some cases, a minor-version mismatch will not cause later errors: https://github.com/NVIDIA/apex/pull/323#discussion_r287021798. You can try commenting out this check (at your own risk).
此后我就知道我需要将CUDA版本降级到9.0.176,并使用以下代码进行了降级:
!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
我得到了here
但是,这在我收到此错误时不起作用:
--2020-03-24 13:15:36-- https://developer.nvidia.com/compute/cuda/9.0/Prod/local_installers/cuda-repo-ubuntu1604-9-0-local_9.0.176-1_amd64-deb
Resolving developer.nvidia.com (developer.nvidia.com)... 152.199.16.29
Connecting to developer.nvidia.com (developer.nvidia.com)|152.199.16.29|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://developer.download.nvidia.com/compute/cuda/9.0/secure/Prod/local_installers/cuda-repo-ubuntu1604-9-0-local_9.0.176-1_amd64.deb?IMScfi-W1zJ3Wp79Q-2RqX_moDmC9pYGLUriU9OhSPrFsuIxAhKh1BXgcR44eXnLGT4UkrlBdf7n4-3q2GgZxCZgAgkNkxxA4EOyDDQVN5B_eqXLWnuSXZKWVOny13D5KOi8HalLDi7hNAbqlNn2ba7I5BS2m6aSWEX-g121qZ-ZGMzK2cyAyJcE0wEAtKDtJNfSiGnBAiGJ9knSIHDU [following]
--2020-03-24 13:15:37-- https://developer.download.nvidia.com/compute/cuda/9.0/secure/Prod/local_installers/cuda-repo-ubuntu1604-9-0-local_9.0.176-1_amd64.deb?IMScfi-W1zJ3Wp79Q-2RqX_moDmC9pYGLUriU9OhSPrFsuIxAhKh1BXgcR44eXnLGT4UkrlBdf7n4-3q2GgZxCZgAgkNkxxA4EOyDDQVN5B_eqXLWnuSXZKWVOny13D5KOi8HalLDi7hNAbqlNn2ba7I5BS2m6aSWEX-g121qZ-ZGMzK2cyAyJcE0wEAtKDtJNfSiGnBAiGJ9knSIHDU
Resolving developer.download.nvidia.com (developer.download.nvidia.com)... 152.199.20.126
Connecting to developer.download.nvidia.com (developer.download.nvidia.com)|152.199.20.126|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1212738714 (1.1G) [application/x-deb]
Saving to: ‘cuda-repo-ubuntu1604-9-0-local_9.0.176-1_amd64-deb.2’
cuda-repo-ubuntu160 100%[===================>] 1.13G 64.0MB/s in 18s
2020-03-24 13:15:55 (64.6 MB/s) - ‘cuda-repo-ubuntu1604-9-0-local_9.0.176-1_amd64-deb.2’ saved [1212738714/1212738714]
(Reading database ... 157958 files and directories currently installed.)
Preparing to unpack cuda-repo-ubuntu1604-9-0-local_9.0.176-1_amd64-deb ...
Unpacking cuda-repo-ubuntu1604-9-0-local (9.0.176-1) ...
dpkg-deb (subprocess): cannot copy archive member from 'cuda-repo-ubuntu1604-9-0-local_9.0.176-1_amd64-deb' to decompressor pipe: unexpected end of file or stream
dpkg-deb (subprocess): decompressing archive member: lzma error: unexpected end of input
dpkg-deb: error: <decompress> subprocess returned error exit status 2
dpkg: error processing archive cuda-repo-ubuntu1604-9-0-local_9.0.176-1_amd64-deb (--install):
cannot copy extracted data for './var/cuda-repo-9-0-local/cuda-visual-tools-9-0_9.0.176-1_amd64.deb' to '/var/cuda-repo-9-0-local/cuda-visual-tools-9-0_9.0.176-1_amd64.deb.dpkg-new': unexpected end of file or stream
Errors were encountered while processing:
cuda-repo-ubuntu1604-9-0-local_9.0.176-1_amd64-deb
gpg: can't open '/var/cuda-repo-9-0-local/7fa2af80.pub': No such file or directory
Hit:1 http://security.ubuntu.com/ubuntu bionic-security InRelease
Hit:2 http://archive.ubuntu.com/ubuntu bionic InRelease
Hit:3 http://ppa.launchpad.net/graphics-drivers/ppa/ubuntu bionic InRelease
Hit:4 http://archive.ubuntu.com/ubuntu bionic-updates InRelease
Hit:5 http://ppa.launchpad.net/marutter/c2d4u3.5/ubuntu bionic InRelease
Hit:6 http://archive.ubuntu.com/ubuntu bionic-backports InRelease
Hit:7 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/ InRelease
Ign:8 https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64 InRelease
Ign:9 https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64 InRelease
Hit:10 https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64 Release
Hit:11 https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64 Release
Reading package lists... Done
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Version '9.0.176-1' for 'cuda' was not found
我认为找不到我要下载的CUDA版本,如底部所示。如何正确找到要下载的CUDA版本以进行降级?
有时无法在Colab中使用易于安装Cuda的功能,您可以检查此内容
!sudo sh cuda-repo-ubuntu1704-9-0-local_9.0.176-1_amd64-deb
!sudo sh cuda-repo-ubuntu1704-9-0-176-local-patch-4_1.0-1_amd64-deb
!export PATH = $ PATH:/usr/local/cuda-9.0/bin
!export CUDADIR = / usr / local / cuda-9.0
!export LD_LIBRARY_PATH = $ LD_LIBRARY_PATH:/usr/local/cuda-9.0/lib64
!pip3安装https://download.pytorch.org/whl/cu90/torch-1.0.0-cp36-cp36m-linux_x86_64.whl
以上是关于将Colab上的CUDA版本降级到9的主要内容,如果未能解决你的问题,请参考以下文章
谷歌 colab 上的 pytorch 几何“检测到 PyTorch 和 torch_sparse 是用不同的 CUDA 版本编译的”
将 GCC 9.3.0 降级到 7 以用于 openpose 后,cuda_compile_1_generated_batch_norm_layer.cu.o.Release.cmake 出现 CMa
pytorch 代码突然在 colab 上失败,系统上的 NVIDIA 驱动程序太旧了