CentOS安装CUDA和cudnn

##### 1st install nividia driver
yum -y install gcc-c++
#install ELR source
sudo rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
sudo rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm
sudo yum install nvidia-detect
#download NVIDIA driver for GTX1060 https://www.geforce.cn/drivers/results/148530
sudo bash NVIDIA-Linux-x86_64-430.26.run
lsmod | grep nouveau #check conflict between nouveau driver and nvidia driver
sudo echo -e "blacklist nouveau\noptions nouveau modeset=0" > /etc/modprobe.d/blacklist.conf #forbid the noveau starting
mv /boot/initramfs-$(uname -r).img /boot/initramfs-$(uname -r).img.bak #backup image
dracut /boot/initramfs-$(uname -r).img $(uname -r)
sudo systemctl stop gdm.service #shut down x windows for nividia driver install
ctrl+alt+F2
sudo sh NVIDIA-Linux-x86_64-384.59.run #install and reboot later

##### 2nd install CUDA
sudo systemctl stop gdm.service 
ctrl+alt+F2
sudo sh cuda_10.1.168_418.67_linux.run

##### 3rd install cudnn
tar -xzvf cudnn-9.0-linux-x64-v7.6.0.tgz
sudo cp cuda/include/cudnn.h /usr/local/cuda/include
sudo cp cuda/lib64/libcudnn* /usr/local/cuda/lib64
sudo chmod a+r /usr/local/cuda/include/cudnn.h /usr/local/cuda/lib64/libcudnn*

##### 4nd check cuda & cudnn version
cat /usr/local/cuda/version.txt
cat /usr/local/cuda/include/cudnn.h | grep CUDNN_MAJOR -A 2

 

你可能感兴趣的:(CentOS安装CUDA和cudnn)