ubuntu 22.04 安装 RTX 4090 显卡驱动

1. 官网下载4090:驱动程序

2. 关闭图形界面

sudo systemctl set-default multi-user.target
sudo reboot

对应的打开图形界面命令为:

sudo systemctl set-default graphical.target
sudo reboot

3. tty登录之后

安装新版驱动:

# 切换到驱动目录
cd /home/user/download/
# 权限
sudo chmod a+x NVIDIA-Linux-x86_64-520.56.06.run
# 安装
sudo ./NVIDIA-Linux-x86_64-520.56.06.run

如果报错,信息如下:

ERROR: An NVIDIA kernel module 'nvidia-drm' appears to already be loaded in your kernel.  This may be because it is in use (for example, by an X server, a CUDA program, or the NVIDIA       
         Persistence Daemon), but this may also happen if your kernel was configured without support for module unloading.  Please be sure to exit any programs that may be using the GPU(s)   
         before attempting to upgrade your driver.  If no GPU-based programs are running, you know that your kernel supports module unloading, and you still receive this message, then an     
         error may have occurred that has corrupted an NVIDIA kernel module's usage count, for which the simplest remedy is to reboot your computer.

则需要卸载老版 nvidia 驱动:

(1)如果有老版驱动安装包,则运行如下命令:

./NVIDIA-Linux-x86-310.19.run --uninstall
reboot now

(2)没有老版驱动安装包,可以使用如下命令删除 niidia 驱动,并使用 autoremove 清除所有不必要的相关套件:

apt-get purge nvidia*
apt-get autoremove
reboot

或者关闭所有装置,并停止载入 nvidia 驱动:

systemctl isolate multi-user.target
modprobe -r nvidia-drm

成功卸载掉老款驱动后,重新运行下载的驱动安装包,期间可能提示你安装 gcc、make 命令后再安装。

4. 打开图形界面并重启

sudo systemctl set-default graphical.target
sudo reboot

安装后第一次开机时间较长,耐心等待

经验证,更换4090显卡后,基于cuda10.2编译的pytorch已不受支持;

更换为cuda11.6编译的pytorch可正常使用。

conda install pytorch torchvision torchaudio cudatoolkit=11.6 -c pytorch -c conda-forge

5. 安装 cuda +  cudnn,参考:

CentOS7 安装Nvidia Tesla T4驱动 CUDA CUDNN,The third-party dynamic library (libcudnn.so) that Paddle,_centos7安装t4驱动_愚昧之山绝望之谷开悟之坡的博客-CSDN博客

使用.deb安装cudnn8.6.0_weixin_44011046的博客-CSDN博客 

Ubuntu20.04安装cuDNN(包括WSL)_cudnn安装 ubuntu_lconghe的博客-CSDN博客 

猜你喜欢

转载自blog.csdn.net/JineD/article/details/129432308