ubuntu18.04 安装CUDA10.0

NVIDIA驱动在上一篇以及安装完了,这里开始安装CUDA10.0
从NVIDIA网站上下载系统版本所对应的runfile(local)文件

chmod +x cuda_10.0.130_410.48_linux.run 
sudo sh ./cuda_10.0.130_410.48_linux.run

然后第一个问你是否安装NVIDIA驱动,填n
后面了填y,安装目录默认回车

Do you accept the previously read EULA?
accept/decline/quit: accept

Install NVIDIA Accelerated Graphics Driver for Linux-x86_64 410.48?
(y)es/(n)o/(q)uit: n

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: 
Install the CUDA 10.0 Samples?
(y)es/(n)o/(q)uit: y

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

安装完成后

Installing the CUDA Toolkit in /usr/local/cuda-10.0 ...
 
Installing the CUDA Samples in /home/jason ...
Copying samples to /home/jason/NVIDIA_CUDA-10.0_Samples now...
Finished copying samples.

===========
= Summary =
===========

Driver:   Not Selected
Toolkit:  Installed in /usr/local/cuda-10.0
Samples:  Installed in /home/jason

Please make sure that
 -   PATH includes /usr/local/cuda-10.0/bin
 -   LD_LIBRARY_PATH includes /usr/local/cuda-10.0/lib64, or, add /usr/local/cuda-10.0/lib64 to /etc/ld.so.conf and run ldconfig as root

To uninstall the CUDA Toolkit, run the uninstall script in /usr/local/cuda-10.0/bin

Please see CUDA_Installation_Guide_Linux.pdf in /usr/local/cuda-10.0/doc/pdf for detailed information on setting up CUDA.

***WARNING: Incomplete installation! This installation did not install the CUDA Driver. A driver of version at least 384.00 is required for CUDA 10.0 functionality to work.
To install the driver using this installer, run the following command, replacing  with the name of this run file:
    sudo .run -silent -driver

Logfile is /tmp/cuda_install_2813.log

接下来需要将cuda的目录设置到PATH

cd ~
sudo gedit .bashrc

在最后面添加或是修改为

export LD_LIBRARY_PATH=/usr/local/cuda-10.0/lib64:/usr/local/cuda/extras/CPUTI/lib64
export CUDA_HOME=/usr/local/cuda-10.0/bin
export PATH=$PATH:$LD_LIBRARY_PATH:$CUDA_HOME

检验cuda环境是否配置好了

nvcc -V
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2018 NVIDIA Corporation
Built on Sat_Aug_25_21:08:01_CDT_2018
Cuda compilation tools, release 10.0, V10.0.130
cd ~/NVIDIA_CUDA-10.0_Samples/1_Utilities/bandwidthTest
make
./bandwidthTest

返回 Result = PASS代表cuda安装成功了

开始安装cuDNN

在cuDNN Archive下载CUDA10.0对应的版本,cuDNN Library for Linux

tar -zxvf cudnn-9.0-linux-x64-v7.1.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 
sudo chmod a+r /usr/local/cuda/lib64/libcudnn*

安装cuDNN完成

你可能感兴趣的:(ubuntu,深度学习)