sudo gedit /etc/modprobe.d/blacklist.conf # 在blacklist.conf文件末尾加上 blacklist nouveau
sudo update-initramfs -u # 更新
reboot
lsmod | grep nouveau # 没有输出说明禁用成功
sudo apt-get update
sudo apt-get install gcc
sudo apt-get install ubuntu-make
sudo apt-get install make
sudo apt-get remove –purge nvidia* # 删除旧版本驱动
sudo chmod a+x NVIDIA-Linux-x86_64-515.57.run # 添加可执行权限
sudo ./NVIDIA-Linux-x86_64-515.57.run -no-x-check -no-nouveau-check -no-opengl-files # 以下两个选择与默认相反,其他选择与默认一致
# 1. Install NVIDIA’s 32-bit compatibility libraries 选择与默认相反的选项: no
# 2. Would you like to run the nvidia-xconfigutility to automatically update your x configuration so that the NVIDIA x driver will be used when you restart x? Any pre-existing x confile will be backed up. 选择与默认相反选项: yes
nvidia-smi # 有显存占用率等信息的表格出现代表安装成功
nvidia 官网找到 CUDA 安装包: https://developer.nvidia.com/cuda-downloads
runfile (local)
安装依赖
sudo apt-get install build-essential
下载安装包并安装
wget https://developer.download.nvidia.com/compute/cuda/11.7.0/local_installers/cuda_11.7.0_515.43.04_linux.run
sudo sh cuda_11.7.0_515.43.04_linux.run
mkdir cudnn_8.4.1.50
tar xvf cudnn-linux-x86_64-8.4.1.50_cuda11.6-archive.tar.xz -C cudnn_8.4.1.50
cd cudnn_8.4.1.50
sudo cp cuda/include/cudnn.h /usr/local/cuda/include # 注意看下 cudnn.h 目录结构是否正确
sudo cp cuda/lib64/libcudnn* /usr/local/cuda/lib64
sudo chmod a+r /usr/local/cuda/include/cudnn.h
sudo chmod a+r /usr/local/cuda/lib64/libcudnn*