Install NVIDIA
sudo vim /etc/modprobe.d/blacklist.conf
add the following lines to the end of the file blacklist.conf
blacklist vga16fb
blacklist nouveau
blacklist rivafb
blacklist rivatv
blacklist nvidiafb
sudo update-initramfs -u
sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt-get update
sudo apt-get install nvidia-418
Install CUDA
cuda 10.0
- Download cuda 10
- 装的时候看着点,第二个要你装驱动的选择,回答N,不装。
sudo sh cuda_10.0.130_410.48_linux.run
sudo vim ~/.bashrc
add the following lines to the end of the file ~/.bashrc
export PATH=/usr/bin:/usr/local/cuda-10.0/bin${PATH}
export LD_LIBRARY_PATH=/usr/local/cuda-10.0/lib64:${LD_LIBRARY_PATH}
source ~/.bashrc
cuda 11.1
百度网盘链接
密码: bo6f
sudo sh cuda_11.1.0_455.23.05_linux.run
安装成功后跳出
===========
= Summary =
===========
Driver: Not Selected
Toolkit: Installed in /usr/local/cuda-11.1/
Samples: Not Selected
Please make sure that
- PATH includes /usr/local/cuda-11.1/bin
- LD_LIBRARY_PATH includes /usr/local/cuda-11.1/lib64, or, add /usr/local/cuda-11.1/lib64 to /etc/ld.so.conf and run ldconfig as root
To uninstall the CUDA Toolkit, run cuda-uninstaller in /usr/local/cuda-11.1/bin
***WARNING: Incomplete installation! This installation did not install the CUDA Driver. A driver of version at least .00 is required for CUDA 11.1 functionality to work.
To install the driver using this installer, run the following command, replacing <CudaInstaller> with the name of this run file:
sudo <CudaInstaller>.run --silent --driver
Logfile is /var/log/cuda-installer.log
修改 ~/.bashrc 文件
sudo vim ~/.bashrc
add the following lines to the end of the file ~/.bashrc
export PATH=/usr/local/cuda-11.1/bin${PATH}
export LD_LIBRARY_PATH=/usr/local/cuda-11.1/lib64:${LD_LIBRARY_PATH}
source ~/.bashrc
Install cudnn
https://developer.nvidia.com/rdp/cudnn-archive
tar xvzf cudnn-10.0-linux-x64-v7.6.4.38.tgz
sudo cp -rp cuda/include/cudnn.h /usr/local/cuda-10.0/include
sudo cp -rp cuda/lib64/libcudnn* /usr/local/cuda-10.0/lib64
sudo chmod a+r /usr/local/cuda-10.0/include/cudnn.h /usr/local/cuda-10.0/lib64/libcudnn*
cudnn 8.0.5
百度网盘
密码: 935g
tar xvzf cudnn-10.0-linux-x64-v7.6.4.38.tgz
sudo cp -rp cuda/include/cudnn.h /usr/local/cuda-10.0/include
sudo cp -rp cuda/lib64/libcudnn* /usr/local/cuda-10.0/lib64
sudo chmod a+r /usr/local/cuda-10.0/include/cudnn.h /usr/local/cuda-10.0/lib64/libcudnn*
Install Anaconda
sha256sum Anaconda3-2019.10-Linux-x86_64.sh
bash Anaconda3-2019.10-Linux-x86_64.sh
source ~/.bashrc
Install PyTorch
conda install pytorch==1.2.0 torchvision==0.4.0 cudatoolkit=10.0 -c pytorch
Install Tensorflow
conda install -c anaconda tensorflow-gpu
Test
import torch
torch.cuda.is_available()
>>> True
import tensorflow as tf
tf.test.is_gpu_available()
>>> True