# 切换root账号操作
# 进行一些依赖库的升级也很必要
# 卸载驱动和cuda
nvidia-uninstall
cuda-uninstaller
# 关闭 nouveau
lsmod | grep nouveau
vim /lib/modprobe.d/dist-blacklist.conf
# 去掉 nvidiafb 注释
# 添加:
blacklist nouveau
options nouveau modeset=0
# 重建initramfs image:
mv /boot/initramfs-$(uname -r).img /boot/initramfs-$(uname -r).img.bak
dracut /boot/initramfs-$(uname -r).img $(uname -r)
# 文本模式
systemctl set-default multi-user.target # 切换回图形界面:systemctl set-default graphical.target
reboot
#安装
chmod a+x NVIDIA-Linux-x86_64-470.86.run
./NVIDIA-Linux-x86_64-470.86.run
# nvidia 安装成功
nvidia-smi
# 安装cuda:
sh cuda_11.5.1_495.29.05_linux.run #默认更新driver从470到495
# 成功之后按照提示添加路径:
vim /etc/profile
export CUDA_HOME=/usr/local/cuda-11.5
export LD_LIBRARY_PATH=${CUDA_HOME}/lib64:${CUDA_HOME}/extras/CUPTI/lib64
export PATH=${CUDA_HOME}/bin:${PATH}
source /etc/profile
# 安装cudnn(别用rpm安装!!!老老实实压缩包解压):
tar -zxvf cudnn-11.5-linux-x64-v8.3.0.98.tgz
# 将解压后中的部分文件复制到目标路径下,并更改权限
cp cuda/include/cudnn*.h /usr/local/cuda/include
cp -P cuda/lib64/libcudnn* /usr/local/cuda/lib64
chmod a+r /usr/local/cuda/include/cudnn*.h /usr/local/cuda/lib64/libcudnn*
# 检查:
nvidia-smi
nvcc -V
# 大功告成!
-
nvidia-smi
-
nvcc -V
-
tensorflow检验
-
torch检验: