环境
Ubuntu:Server 20.04.4 LTS
CUDA:11.6
显卡:GeForce 1080 Ti
1. JDK8安装
sudo apt-get install openjdk-8-jdk
# 如果原本已安装jdk,可用以下命令进行切换
sudo update-alternatives --config java
2. 显卡驱动安装
2.1 官网查看并下载显卡驱动版本
https://www.nvidia.cn/Download/index.aspx?lang=cn
image.png
2.2 禁用The Nouveau kernel driver
sudo vi /etc/modprobe.d/blacklist.conf
在文件 blacklist.conf 中加入如下内容:
blacklist nouveau
blacklist lbm-nouveau
options nouveau modeset=0
sudo update-initramfs -u
sudo reboot
2.3 重启后安装
sudo apt-get install gcc make
sudo chmod +x NVIDIA-Linux-x86_64-510.60.02.run
sudo ./NVIDIA-Linux-x86_64-510.60.02.run
image.png
2.4 错误提示
如果不禁用Nouveau kernel driver会出现以下错误提示
image.png
如果不安装gcc
和make
会出现以下提示
image.png
2.5 查看显卡
nvidia-smi
3. 安装CUDA
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-ubuntu2004.pin
sudo mv cuda-ubuntu2004.pin /etc/apt/preferences.d/cuda-repository-pin-600
wget https://developer.download.nvidia.com/compute/cuda/11.6.2/local_installers/cuda-repo-ubuntu2004-11-6-local_11.6.2-510.47.03-1_amd64.deb
sudo dpkg -i cuda-repo-ubuntu2004-11-6-local_11.6.2-510.47.03-1_amd64.deb
sudo apt-key add /var/cuda-repo-ubuntu2004-11-6-local/7fa2af80.pu
sudo apt-get update
sudo apt-get -y install cuda
4. Pytorch
https://pytorch.org/get-started/locally/
sudo apt install python3-pip
pip3 install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu113 -i https://pypi.tuna.tsinghua.edu.cn/simple
网友评论