在Ubuntu 20.04上安装适当版本的CUDA和CuDNN后,torch.cuda.is_available()重新调整为FALSE

时间:2020-09-08 15:33:53

标签: pytorch ubuntu-20.04

enter image description here

我应该说在装有Ubuntu 20.04的Z490主板上进行安装非常棘手。

enter image description here

上面是nvidia --versionnvidia-smi的屏幕截图

我能够完成所有CUDA和CuDNN的安装。

我用了所有这些。但是pytorch无法检测到GPU。

pip3 install torch==1.5.1+cu101 torchvision==0.6.1+cu101 -f https://download.pytorch.org/whl/torch_stable.html

pip install torch torchvision

pip install torch==1.6.0+cu101 torchvision==0.7.0+cu101 -f https://download.pytorch.org/whl/torch_stable.html

非常感谢。有人请帮助我摆脱困境。

whereis cuda
cuda: /usr/lib/cuda /usr/include/cuda.h

whereis nvcc
nvcc: /usr/bin/nvcc /etc/nvcc.profile /usr/share/man/man1/nvcc.1.gz

但是在某些论坛中,我在某些论坛中看到的路径是/ usr / local / cuda

除此之外,我的~/.bashrc还包含以下内容:

export LD_LIBRARY_PATH=/usr/lib/cuda/lib64:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=/usr/lib/cuda/include:$LD_LIBRARY_PATH

2 个答案:

答案 0 :(得分:0)

我认为您还需要cudatoolkit

conda安装最简单:

conda install pytorch torchvision cudatoolkit=10.2 -c pytorch

或使用cuda 10.1

conda install pytorch torchvision cudatoolkit=10.1 -c pytorch

答案 1 :(得分:0)

此问题已解决。

 $ ubuntu-drivers devices
== /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0 ==
modalias : pci:v000010DEd00001C03sv00001043sd000085ABbc03sc00i00
vendor   : NVIDIA Corporation
model    : GP106 [GeForce GTX 1060 6GB]
driver   : nvidia-driver-390 - distro non-free
driver   : nvidia-driver-435 - distro non-free
driver   : nvidia-driver-440 - distro non-free recommended
driver   : xserver-xorg-video-nouveau - distro free builtin

最初,在安装nvidia驱动程序nvidia-driver-450时不可用。但是CUDA 11工具箱是基于nvidia-driver-450构建的。为此,我们需要使用PPA存储库安装Nvidia Beta驱动程序。

使用

$ sudo add-apt-repository ppa:graphics-drivers/ppa
$ sudo apt install nvidia-driver-450

其余过程相同。在这里安装CUDA和CUDA工具包,CuDNN和bammmm。 enter image description here

相关问题