centos7.6 安裝 cuda驅動

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

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章