1、首先确认 nouveau 模块有没有启用,如果启用的话禁掉。
2、如果是高版本的系统,则需要高版本的nvidia cuda以及cudnn
nvidia驱动官网
https://www.nvidia.com/Download/index.aspx?spm=a2c63.p38356.879954.7.2c524526OCooRk&lang=cn
选择驱动要根据实际的GPU卡型号选,可以参考阿里云上的文章:
https://www.alibabacloud.com/help/zh/doc-detail/108502.htm
cuda驱动下载网址
https://developer.nvidia.com/cuda-downloads
比如下载10.0 10.1 相对高版本的驱动程序
cudnn也选择较高版本,例如10.0
cudnn下载地址
https://developer.nvidia.com/cudnn
3、安装驱动
3.1、安装nvidia驱动
sh NVIDIA-Linux-x86_64-410.129-diagnostic
验证
nvidia-smi
3.2、安装cuda驱动
yum -y install gcc kernel-devel "kernel-devel-uname-r == $(uname -r)" dkms
sh cuda_10.0.130_410_48_linux.run
Do you accept the previously read EULA?
accept/decline/quit: accept
Install NVIDIA Accelerated Graphics Driver for Linux-x86_64 396.37?
(y)es/(n)o/(q)uit: y
Do you want to install the OpenGL libraries?
(y)es/(n)o/(q)uit [ default is yes ]: y
Do you want to run nvidia-xconfig?
This will update the system X configuration file so that the NVIDIA X driver
is used. The pre-existing X configuration file will be backed up.
This option should not be used on systems that require a custom
X configuration, such as systems with multiple GPU vendors.
(y)es/(n)o/(q)uit [ default is no ]:
Install the CUDA 10.0 Toolkit?
(y)es/(n)o/(q)uit: y
Enter Toolkit Location
[ default is /usr/local/cuda-10.0 ]:
Do you want to install a symbolic link at /usr/local/cuda?
(y)es/(n)o/(q)uit: y
Install the CUDA 10.0 Samples?
(y)es/(n)o/(q)uit: y
Enter CUDA Samples Location
[ default is /root ]:
编辑环境变量
vi /etc/profile
export PATH=$PATH:/usr/local/cuda-10.0/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-10.0/lib64
source /etc/profile
3.3、安装cudnn
tar -zxf cudnn-10.0-linux-x64-v7.5.0.56.tgz
cd cuda10
cp include/cudnn.h /usr/local/cuda-10.0/include/
cp lib64/libcudnn* /usr/local/cuda-10.0/lib64/
chmod a+r /usr/local/cuda-10.0/include/cudnn.h /usr/local/cuda-10.0/lib64/libcudnn*
4、卸载cuda驱动
/usr/local/cuda-10.0/bin/uninstall_cuda_10.0.pl
/usr/bin/nvidia-uninstall
reboot
参考:
https://blog.csdn.net/miaoyitao/article/details/103461014
https://blog.csdn.net/QLULIBIN/article/details/79600981