ubuntu18.04安装CUDA10.0

1、更新驱动

ubuntu18.04安装CUDA10.0_第1张图片
对于CUDA10.0,要求驱动版本大于410.48,因此首先要更新驱动

ubuntu-drivers devices(查看所有驱动)
sudo ubuntu-drivers autoinstall(自动安装最适合的驱动)

查看驱动版本

nvidia-smi
ubuntu18.04安装CUDA10.0_第2张图片

2、下载CUDA10.0

https://developer.nvidia.com/cuda-toolkit-archive

选择10.0版本后,进行如下选择
ubuntu18.04安装CUDA10.0_第3张图片
下载这个2.0G的。

3、安装

  • 将下载的包复制到主目录下
  • 运行以下命令

chmod 777 cuda_10.0.130_410.48_linux.run
sudo ./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 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: y

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

Installing the CUDA Toolkit in /usr/local/cuda-10.0 ...
  • 安装结束,终端中会显示如下信息:
Installing the CUDA Toolkit in /usr/local/cuda-10.0 ...
Missing recommended library: libGLU.so
Missing recommended library: libX11.so
Missing recommended library: libXi.so
Missing recommended library: libXmu.so

Installing the CUDA Samples in /home/test ...
Copying samples to /home/test/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/test, but missing recommended libraries

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 <CudaInstaller> with the name of this run file:
    sudo <CudaInstaller>.run -silent -driver

Logfile is /tmp/cuda_install_8442.log
  • 安装缺失的包
sudo apt-get install freeglut3-dev build-essential libx11-dev libxmu-dev libxi-dev libgl1-mesa-glx libglu1-mesa libglu1-mesa-dev 

4、配置环境变量

sudo gedit ~/.bashrc

  • 在末尾写入
# for CUDA 10.0
export CUDA_10_0_HOME=/usr/local/cuda-10.0
export PATH=$PATH:$CUDA_10_0_HOME/bin 
export LD_LIBRARY_PATH=CUDA_10_0_HOME/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}

ubuntu18.04安装CUDA10.0_第4张图片

  • 运行环境变量

source ~/.bashrc

5、验证

cd /usr/local/cuda/samples/1_Utilities/deviceQuery
./deviceQuery

ubuntu18.04安装CUDA10.0_第5张图片

nvcc --version

在这里插入图片描述

cat /usr/local/cuda/version.txt

在这里插入图片描述

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