nvidia ubuntu 驱动升级_Ubuntu16.04上升级NVIDIA显卡驱动及安装CUDA10.0操作步骤

Ubuntu 16.04上已装有CUDA 8.0,现在想再安装CUDA 10.0,由于已安装的显卡驱动版本396.54不支持CUDA 10.0,因此安装CUDA 10.0之前需要先升级显卡驱动到410及以上版本。

可在https://docs.nvidia.com/cuda/cuda-toolkit-release-notes/index.html中查看对应的显卡驱动支持的CUDA版本。

1. 升级显卡驱动版本到430,依次执行如下命令后,重启电脑,

sudo apt-get update

sudo add-apt-repository ppa:graphics-drivers/ppa

sudo apt install nvidia-430

通过终端nvidia-smi命令查看,可查看显卡驱动信息,结果如下图所示,升级成功:

2. 安装CUDA 10.0:

(1).从https://developer.nvidia.com/cuda-10.0-download-archive?target_os=Linux&target_arch=x86_64&target_distro=Ubuntu&target_version=1604 下载runfile(local)的CUDA,即cuda_10.0.130_410.48_linux.run;

(2).执行如下命令,安装CUDA 10.0:

sudo sh cuda_10.0.130_410.48_linux.run

在终端所做的选择:

Do you accept the previously read EULA? accept

Install NVIDIA Accelerated Graphics Driver for Linux-x86_64 410.48? n

Install the CUDA 10.0 Toolkit? y

Enter Toolkit Location [ default is /usr/local/cuda-10.0 ]: Enter

Do you want to install a symbolic link at /usr/local/cuda? y

Install the CUDA 10.0 Samples? y

Enter CUDA Samples Location [default is /home/xxxx ]: Enter

(3).验证CUDA 10.0是否安装正确,依次执行如下命令:

cd /usr/local/cuda/samples

sudo make -k

./1_Utilities/deviceQuery/deviceQuery

执行结果如下图所示,说明CUDA 10.0安装正确:

3. 安装cuDNN:

(1).从https://developer.nvidia.com/rdp/cudnn-archive下载:cuDNN v7.3.0 Runtime Library for Ubuntu16.04 (Deb), cuDNN v7.3.0 Developer Library for Ubuntu16.04 (Deb), cuDNN v7.3.0 Code Samples and User Guide for Ubuntu16.04 (Deb)即libcudnn7_7.3.0.29-1+cuda10.0_amd64.deb、libcudnn7-dev_7.3.0.29-1+cuda10.0_amd64.deb、libcudnn7-doc_7.3.0.29-1+cuda10.0_amd64.deb;

(2).安装.deb包:默认cudnn动态库会安装在/usr/lib/x86_64-linux-gnu目录下,cudnn.h会安装到/usr/include目录下,cudnn_samples_v7会安装到/usr/src目录下

sudo dpkg -i libcudnn7_7.3.0.29-1+cuda10.0_amd64.deb

sudo dpkg -i libcudnn7-dev_7.3.0.29-1+cuda10.0_amd64.deb

sudo dpkg -i libcudnn7-doc_7.3.0.29-1+cuda10.0_amd64.deb

4. Export CUDA路径,打开/etc/profile文件:

(1).在原有LD_LIBRARY_PATH值的基础上增加/usr/local/cuda-10.0/lib64;

(2).在原有PATH值的基础上增加/usr/local/cuda-10.0/bin;

5.验证cuDNN是否安装正确:

(1).进入到/usr/src/cudnn_samples_v7/mnistCUDNN目录下;

(2).依次执行如下命令:

sudo make

./mnistCUDNN

执行结果如下图所示,说明安装正确:

GitHub:https://github.com/fengbingchun/CUDA_Test

你可能感兴趣的:(nvidia,ubuntu,驱动升级)