Ubuntu 16.04 安装 CUDA Toolkit 10.0

NVIDIA 引领人工智能计算 - NVIDIA
https://www.nvidia.cn/

CUDA Zone
https://developer.nvidia.com/cuda-zone

Download Now -> Legacy Releases
https://developer.nvidia.com/cuda-downloads

CUDA Toolkit Archive
https://developer.nvidia.com/cuda-toolkit-archive

CUDA Toolkit 10.0 Archive - CUDA Toolkit 10.0
https://developer.nvidia.com/cuda-10.0-download-archive

CUDA Toolkit Documentation v10.0.130
https://docs.nvidia.com/cuda/archive/10.0/

1. CUDA Toolkit 10.0 Archive - CUDA Toolkit 10.0

1.1 Select Target Platform

1.2 Download Installers for Linux Ubuntu 16.04 x86_64

The base installer is available for download below.
There is 1 patch available. This patch requires the base installer to be installed first.

prompt [prɒm(p)t]:v. 提示,鼓励,促进,激起,导致,提白 adj. 敏捷的,迅速的,立刻的,及时的,准时的,即期要送的 n. 提示,提词,提示符,鼓励,催促,付款期限 adv. 准时地

cuda_10.0.130_410.48_linux.run
cuda_10.0.130.1_linux.run

legacy ['legəsɪ]:n. 遗赠,遗产

建议使用 runfile 安装。

2. PRE-INSTALLATION ACTIONS

Some actions must be taken before the CUDA Toolkit and Driver can be installed on Linux.

You can override the install-time prerequisite checks by running the installer with the -override flag. Remember that the prerequisites will still be required to use the NVIDIA CUDA Toolkit.
您可以通过使用 -override 标志运行安装程序来不理会安装时必备条件检查。请记住,使用 NVIDIA CUDA 工具包仍然需要满足必备条件。

2.1. Verify You Have a CUDA-Capable GPU

To verify that your GPU is CUDA-capable, go to your distribution’s equivalent of System Properties, or, from the command line, enter:
要验证您的 GPU 是否具有 CUDA 功能,请转至您的发行版等效的系统属性,或者从命令行输入:

$ lspci | grep -i nvidia

If you do not see any settings, update the PCI hardware database that Linux maintains by entering update-pciids (generally found in /sbin) at the command line and rerun the previous lspci command.
如果没有看到任何设置,请通过在命令行输入 update-pciids (通常位于 /sbin 中) 并重新运行以前的 lspci 命令来更新 Linux 维护的 PCI 硬件数据库。

If your graphics card is from NVIDIA and it is listed in http://developer.nvidia.com/ cuda-gpus, your GPU is CUDA-capable.
如果你的显卡来自 NVIDIA 并且它在 http://developer.nvidia.com/ cuda-gpus 中列出,那么你的 GPU 就具备了 CUDA 功能。

The Release Notes for the CUDA Toolkit also contain a list of supported products.
CUDA 工具包的发行说明还包含受支持产品的列表。

deepnorth@deepnorth-amax:~$ lspci | grep -i nvidia
1b:00.0 VGA compatible controller: NVIDIA Corporation Device 1e04 (rev a1)
1b:00.1 Audio device: NVIDIA Corporation Device 10f7 (rev a1)
1b:00.2 USB controller: NVIDIA Corporation Device 1ad6 (rev a1)
1b:00.3 Serial bus controller [0c80]: NVIDIA Corporation Device 1ad7 (rev a1)
1c:00.0 VGA compatible controller: NVIDIA Corporation Device 1e04 (rev a1)
1c:00.1 Audio device: NVIDIA Corporation Device 10f7 (rev a1)
1c:00.2 USB controller: NVIDIA Corporation Device 1ad6 (rev a1)
1c:00.3 Serial bus controller [0c80]: NVIDIA Corporation Device 1ad7 (rev a1)
1d:00.0 VGA compatible controller: NVIDIA Corporation Device 1e04 (rev a1)
1d:00.1 Audio device: NVIDIA Corporation Device 10f7 (rev a1)
1d:00.2 USB controller: NVIDIA Corporation Device 1ad6 (rev a1)
1d:00.3 Serial bus controller [0c80]: NVIDIA Corporation Device 1ad7 (rev a1)
1e:00.0 VGA compatible controller: NVIDIA Corporation Device 1e04 (rev a1)
1e:00.1 Audio device: NVIDIA Corporation Device 10f7 (rev a1)
1e:00.2 USB controller: NVIDIA Corporation Device 1ad6 (rev a1)
1e:00.3 Serial bus controller [0c80]: NVIDIA Corporation Device 1ad7 (rev a1)
89:00.0 VGA compatible controller: NVIDIA Corporation Device 1e04 (rev a1)
89:00.1 Audio device: NVIDIA Corporation Device 10f7 (rev a1)
89:00.2 USB controller: NVIDIA Corporation Device 1ad6 (rev a1)
89:00.3 Serial bus controller [0c80]: NVIDIA Corporation Device 1ad7 (rev a1)
8a:00.0 VGA compatible controller: NVIDIA Corporation Device 1e04 (rev a1)
8a:00.1 Audio device: NVIDIA Corporation Device 10f7 (rev a1)
8a:00.2 USB controller: NVIDIA Corporation Device 1ad6 (rev a1)
8a:00.3 Serial bus controller [0c80]: NVIDIA Corporation Device 1ad7 (rev a1)
8b:00.0 VGA compatible controller: NVIDIA Corporation Device 1e04 (rev a1)
8b:00.1 Audio device: NVIDIA Corporation Device 10f7 (rev a1)
8b:00.2 USB controller: NVIDIA Corporation Device 1ad6 (rev a1)
8b:00.3 Serial bus controller [0c80]: NVIDIA Corporation Device 1ad7 (rev a1)
8c:00.0 VGA compatible controller: NVIDIA Corporation Device 1e04 (rev a1)
8c:00.1 Audio device: NVIDIA Corporation Device 10f7 (rev a1)
8c:00.2 USB controller: NVIDIA Corporation Device 1ad6 (rev a1)
8c:00.3 Serial bus controller [0c80]: NVIDIA Corporation Device 1ad7 (rev a1)
deepnorth@deepnorth-amax:~$

2.2. Verify You Have a Supported Version of Linux

The CUDA Development Tools are only supported on some specific distributions of Linux. These are listed in the CUDA Toolkit release notes.
CUDA 开发工具仅在某些特定的 Linux 发行版上受支持。这些列在 CUDA Toolkit 发行说明中。

To determine which distribution and release number you’re running, type the following at the command line:
要确定正在运行的发行版和版本号,请在命令行键入以下内容:

$ uname -m && cat /etc/*release

You should see output similar to the following, modified for your particular system:
您应该看到类似于以下的输出,针对您的特定系统进行了修改:

x86_64
Red Hat Enterprise Linux Workstation release 6.0 (Santiago)

The x86_64 line indicates you are running on a 64-bit system. The remainder gives information about your distribution.
x86_64 行表示您正在 64 位系统上运行。其余部分提供有关您的发行版的信息。

$ uname -m && cat / etc / * release

deepnorth@deepnorth-amax:~$ uname -m && cat /etc/*release
x86_64
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=16.04
DISTRIB_CODENAME=xenial
DISTRIB_DESCRIPTION="Ubuntu 16.04.6 LTS"
NAME="Ubuntu"
VERSION="16.04.6 LTS (Xenial Xerus)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 16.04.6 LTS"
VERSION_ID="16.04"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"
VERSION_CODENAME=xenial
UBUNTU_CODENAME=xenial
deepnorth@deepnorth-amax:~$

2.3. Verify the System Has gcc Installed

The gcc compiler is required for development using the CUDA Toolkit. It is not required for running CUDA applications. It is generally installed as part of the Linux installation, and in most cases the version of gcc installed with a supported version of Linux will work correctly.
使用 CUDA Toolkit 进行开发需要 gcc 编译器。运行 CUDA 应用程序不需要它。它通常作为 Linux 安装的一部分安装,并且在大多数情况下,安装有受支持的 Linux 版本的 gcc 版本将正常工作。

To verify the version of gcc installed on your system, type the following on the command line:
要验证系统上安装的 gcc 版本,请在命令行上键入以下内容:

$ gcc --version

If an error message displays, you need to install the development tools from your Linux distribution or obtain a version of gcc and its accompanying toolchain from the Web.
如果显示错误消息,则需要从 Linux 发行版安装开发工具,或从 Web 获取 gcc 及其附带工具链的版本。

$ gcc --version

accompany [ə'kʌmpənɪ]:vt. 陪伴,伴随,伴奏 vi. 伴奏,伴唱
deepnorth@deepnorth-amax:~$ gcc --version
gcc (Ubuntu 5.4.0-6ubuntu1~16.04.11) 5.4.0 20160609
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.deepnorth@deepnorth-amax:~$

2.4. Verify the System has the Correct Kernel Headers and Development Packages Installed

The CUDA Driver requires that the kernel headers and development packages for the running version of the kernel be installed at the time of the driver installation, as well whenever the driver is rebuilt. For example, if your system is running kernel version 3.17.4-301, the 3.17.4-301 kernel headers and development packages must also be installed.
CUDA 驱动程序要求在安装驱动程序以及重建驱动程序时安装内核运行版本的内核头文件和开发包。例如,如果您的系统运行内核版本 3.17.4-301,则还必须安装 3.17.4-301 内核头文件和开发包。

While the Runfile installation performs no package validation, the RPM and Deb installations of the driver will make an attempt to install the kernel header and development packages if no version of these packages is currently installed. However, it will install the latest version of these packages, which may or may not match the version of the kernel your system is using. Therefore, it is best to manually ensure the correct version of the kernel headers and development packages are installed prior to installing the CUDA Drivers, as well as whenever you change the kernel version.
虽然 Runfile 安装不执行包验证,但如果当前没有安装这些包的版本,则驱动程序的 RPM 和 Deb 安装将尝试安装内核头和开发包。但是,它将安装这些软件包的最新版本,这些软件包可能与您的系统使用的内核版本匹配,也可能不匹配。因此,最好在安装 CUDA 驱动程序之前以及更改内核版本时手动确保安装正确版本的内核头文件和开发包。

The version of the kernel your system is running can be found by running the following command:
可以通过运行以下命令找到系统运行的内核版本:

$ uname -r

This is the version of the kernel headers and development packages that must be installed prior to installing the CUDA Drivers. This command will be used multiple times below to specify the version of the packages to install. Note that below are the common-case scenarios for kernel usage. More advanced cases, such as custom kernel branches, should ensure that their kernel headers and sources match the kernel build they are running.
这是在安装 CUDA 驱动程序之前必须安装的内核头文件和开发包的版本。此命令将在下面多次使用,以指定要安装的软件包的版本。请注意,以下是内核使用的常见方案。 更高级的情况 (例如自定义内核分支) 应确保其内核头和源与它们正在运行的内核构建匹配。

Ubuntu
The kernel headers and development packages for the currently running kernel can be installed with:
可以使用以下命令安装当前运行内核的内核头文件和开发包:

$ sudo apt-get install linux-headers-$(uname -r)

deepnorth@deepnorth-amax:~$ uname -r
4.15.0-54-generic
deepnorth@deepnorth-amax:~$ dpkg --get-selections | grep linux-
linux-base                                      install
linux-firmware                                  install
linux-generic-hwe-16.04                         install
linux-headers-4.10.0-28                         install
linux-headers-4.10.0-28-generic                 install
linux-headers-4.15.0-54                         install
linux-headers-4.15.0-54-generic                 install
linux-headers-generic-hwe-16.04                 install
linux-image-4.10.0-28-generic                   install
linux-image-4.15.0-54-generic                   install
linux-image-extra-4.10.0-28-generic             install
linux-image-generic-hwe-16.04                   install
linux-libc-dev:amd64                            install
linux-modules-4.15.0-54-generic                 install
linux-modules-extra-4.15.0-54-generic           install
linux-sound-base                                install
syslinux-common                                 install
syslinux-legacy                                 install
deepnorth@deepnorth-amax:~$

2.5 Download Verification

The download can be verified by comparing the MD5 checksum posted at http://developer.nvidia.com/cuda-downloads/checksums with that of the downloaded file. If either of the checksums differ, the downloaded file is corrupt and needs to be downloaded again.
可以通过将 http://developer.nvidia.com/cuda-downloads/checksums 上发布的 MD5 校验和与下载文件的校验和进行比较来验证下载。如果任一校验和不同,则下载的文件已损坏,需要再次下载。

To calculate the MD5 checksum of the downloaded file, run the following:
要计算下载文件的MD5校验和,请运行以下命令:

$ md5sum

deepnorth@deepnorth-amax:~$ cd software/
deepnorth@deepnorth-amax:~/software$ ls -l
total 4232476
drwxrwxr-x 4 deepnorth deepnorth       4096 7月  10 11:12 cuda
-rw-rw-r-- 1 deepnorth deepnorth    3329233 7月  11 15:46 cuda_10.0.130.1_linux.run
-rw-rw-r-- 1 deepnorth deepnorth 2020126691 5月  20 18:38 cuda_10.0.130_410.48_linux.run
deepnorth@deepnorth-amax:~/software$
deepnorth@deepnorth-amax:~/software$ sudo chmod 777 cud*
[sudo] password for deepnorth:
deepnorth@deepnorth-amax:~/software$
deepnorth@deepnorth-amax:~/software$ ll
total 4232484
drwxrwxr-x  3 deepnorth deepnorth       4096 7月  11 19:30 ./
drwxr-xr-x 21 deepnorth deepnorth       4096 7月  11 17:45 ../
drwxrwxrwx  4 deepnorth deepnorth       4096 7月  10 11:12 cuda/
-rwxrwxrwx  1 deepnorth deepnorth    3329233 7月  11 15:46 cuda_10.0.130.1_linux.run*
-rwxrwxrwx  1 deepnorth deepnorth 2020126691 5月  20 18:38 cuda_10.0.130_410.48_linux.run*
deepnorth@deepnorth-amax:~/software$
deepnorth@deepnorth-amax:~/software$ md5sum cuda_10.0.130_410.48_linux.run
9375304c8dc8d42e7f9a9ae37e80b42b  cuda_10.0.130_410.48_linux.run
deepnorth@deepnorth-amax:~/software$
deepnorth@deepnorth-amax:~/software$ md5sum cuda_10.0.130.1_linux.run
ac764df6900f0564e35298250736855e  cuda_10.0.130.1_linux.run
deepnorth@deepnorth-amax:~/software$

2.7. Handle Conflicting Installation Methods

Before installing CUDA, any previously installations that could conflict should be uninstalled. This will not affect systems which have not had CUDA installed previously, or systems where the installation method has been preserved (RPM/Deb vs. Runfile). See the following charts for specifics.
在安装 CUDA 之前,应卸载任何可能发生冲突的先前安装。这不会影响以前未安装过 CUDA 的系统,也不会影响已保留安装方法的系统 (RPM / Deb 与 Runfile)。

NVIDIA Driver 和 CUDA Toolkit 卸载命令
Use the following command to uninstall a Toolkit runfile installation:

$ sudo /usr/local/cuda-X.Y/bin/uninstall_cuda_X.Y.pl

Use the following command to uninstall a Driver runfile installation:

$ sudo /usr/bin/nvidia-uninstall

Use the following commands to uninstall a RPM/Deb installation:

$ sudo apt-get --purge remove <package_name> # Ubuntu

3. RUNFILE INSTALLATION

This section describes the installation and configuration of CUDA when using the standalone installer. The standalone installer is a “.run” file and is completely self-contained.
本节介绍使用独立安装程序时 CUDA 的安装和配置。独立安装程序是一个 .run 文件,完全是自包含的。

3.1. Overview

The Runfile installation installs the NVIDIA Driver, CUDA Toolkit, and CUDA Samples via an interactive text-based interface.
Runfile 安装通过基于交互式文本的界面安装 NVIDIA 驱动程序,CUDA 工具包和 CUDA 示例。

Distribution-specific instructions on disabling the Nouveau drivers as well as steps for verifying device node creation are also provided.
还提供了有关禁用 Nouveau 驱动程序的特定于分发的说明以及验证设备节点创建的步骤。

The Runfile installation does not include support for cross-platform development. For cross-platform development, see the CUDA Cross-Platform Environment section.
Runfile 安装不包括对跨平台开发的支持。有关跨平台开发,请参阅 CUDA 跨平台环境部分。

3.2 Disable the Nouveau drivers - Disabling Nouveau

To install the Display Driver, the Nouveau drivers must first be disabled. Each distribution of Linux has a different method for disabling Nouveau.
要安装显示驱动程序,必须首先禁用 Nouveau 驱动程序。Linux 的每个发行版都有一种不同的方法来禁用 Nouveau。

The Nouveau drivers are loaded if the following command prints anything:
如果以下命令打印任何内容,则会加载 Nouveau 驱动程序:

$ lsmod | grep nouveau

lsmod | grep nouveau 查看 nouveau 是否运行,如果看不到任何关于 nouveau 的信息,说明已经关闭。
nouveau 是 Ubuntu 自带的第三方开源 NVIDIA 卡驱动,安装 NVIDIA 官方驱动之前需要禁用 nouveau。不安装 OPENGL (-no-opengl-files).

Ubuntu

  1. Create a file at /etc/modprobe.d/blacklist-nouveau.conf with the following contents:

blacklist nouveau
options nouveau modeset=0

按下 ESC 后输入 :wq 保存并退出。

  1. Regenerate the kernel initramfs:

$ sudo update-initramfs -u

deepnorth@deepnorth-amax:~/software$ lsmod | grep nouveau
deepnorth@deepnorth-amax:~/software$
deepnorth@deepnorth-amax:~/software$ cat /etc/modprobe.d/blacklist-nouveau.conf
blacklist nouveau
options nouveau modeset=0
deepnorth@deepnorth-amax:~/software$

3.3. Installation

This can usually be accomplished by adding the number “3” to the end of the system’s kernel boot parameters.
这通常可以通过在系统的内核引导参数末尾添加数字 3 来实现。

Since the NVIDIA drivers are not yet installed, the text terminals may not display correctly. Temporarily adding “nomodeset” to the system’s kernel boot parameters may fix this issue.
由于尚未安装 NVIDIA 驱动程序,文本终端可能无法正确显示。暂时将 nomodeset 添加到系统的内核引导参数可能会解决此问题。

The reboot is required to completely unload the Nouveau drivers and prevent the graphical interface from loading. The CUDA driver cannot be installed while the Nouveau drivers are loaded or while the graphical interface is active.
需要重新启动才能完全卸载 Nouveau 驱动程序并阻止加载图形界面。加载 Nouveau 驱动程序或图形界面处于活动状态时,无法安装 CUDA 驱动程序。

Verify that the Nouveau drivers are not loaded. If the Nouveau drivers are still loaded, consult your distribution’s documentation to see if further steps are needed to disable Nouveau.
验证是否加载 Nouveau 驱动程序。如果仍然加载了 Nouveau 驱动程序,请查阅您的发行版文档,了解是否需要采取进一步措施来禁用 Nouveau。

$ sudo sh cuda__linux.run

安装 CUDA 时,不能再安装显卡驱动。
Install NVIDIA Accelerated Graphics Driver for Linux-x86_64 375.26? - NVIDIA Accelerated Graphics Driver 已安装,此处不要再安装。
Do you want to install a symbolic link at /usr/local/cuda? - 这是在系统中安装的第二个 CUDA 版本,此处选择 (n)o。

按 CTRL + ALT + F7 无图形化界面,说明已经关闭了图形化界面。
按 CTRL + ALT + F1 进入 tty1 文本模式,关闭 (图形) 桌面显示管理器 lightdm。

deepnorth@deepnorth-amax:~$ cd software/
deepnorth@deepnorth-amax:~/software$
deepnorth@deepnorth-amax:~/software$ ll
total 4232484
drwxrwxr-x  3 deepnorth deepnorth       4096 7月  11 19:30 ./
drwxr-xr-x 21 deepnorth deepnorth       4096 7月  11 17:45 ../
drwxrwxrwx  4 deepnorth deepnorth       4096 7月  10 11:12 cuda/
-rwxrwxrwx  1 deepnorth deepnorth    3329233 7月  11 15:46 cuda_10.0.130.1_linux.run*
-rwxrwxrwx  1 deepnorth deepnorth 2020126691 5月  20 18:38 cuda_10.0.130_410.48_linux.run*
deepnorth@deepnorth-amax:~/software$
deepnorth@deepnorth-amax:~/software$ sudo sh ./cuda_10.0.130_410.48_linux.run
Logging to /tmp/cuda_install_2814.log
Using more to view the EULA.
End User License Agreement
......
Do you accept the previously read EULA?
accept/decline/quit: acceptInstall NVIDIA Accelerated Graphics Driver for Linux-x86_64 410.48?
(y)es/(n)o/(q)uit: nInstall the CUDA 10.0 Toolkit?
(y)es/(n)o/(q)uit: yEnter 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: nInstall the CUDA 10.0 Samples?
(y)es/(n)o/(q)uit: nInstalling the CUDA Toolkit in /usr/local/cuda-10.0 ...===========
= Summary =
===========Driver:   Not Selected
Toolkit:  Installed in /usr/local/cuda-10.0
Samples:  Not SelectedPlease 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 rootTo uninstall the CUDA Toolkit, run the uninstall script in /usr/local/cuda-10.0/binPlease 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 -driverLogfile is /tmp/cuda_install_2814.log
deepnorth@deepnorth-amax:~/software$
deepnorth@deepnorth-amax:~/software$ sudo service lightdm start
deepnorth@deepnorth-amax:~/software$

Default Installation Directory
CUDA Toolkit - /usr/local/cuda-10.0
CUDA Samples - $(HOME)/NVIDIA_CUDA-10.0_Samples

4. Environment Setup

The PATH variable needs to include /usr/local/cuda-10.0/bin

To add this path to the PATH variable:

$ export PATH=/usr/local/cuda-10.0/bin${PATH:+:${PATH}}

In addition, when using the runfile installation method, the LD_LIBRARY_PATH variable needs to contain /usr/local/cuda-10.0/lib64 on a 64-bit system, or /usr/local/cuda-10.0/lib on a 32-bit system

To change the environment variables for 64-bit operating systems:

$ export LD_LIBRARY_PATH=/usr/local/cuda-10.0/lib64\${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}

To change the environment variables for 32-bit operating systems:

$ export LD_LIBRARY_PATH=/usr/local/cuda-10.0/lib\${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}

Note that the above paths change when using a custom install path with the runfile installation method.
请注意,使用自定义安装路径和 runfile 安装方法时,上述路径会发生更改。

4.1 /etc/profile

/etc/profile 文件添加环境设置。

# foreverstrong cuda-8.0
export PATH=/usr/local/cuda-8.0/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-8.0/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
# foreverstrong cuda-9.0
export PATH=/usr/local/cuda-9.0/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-9.0/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
# foreverstrong cuda-10.0
export PATH=/usr/local/cuda-10.0/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-10.0/lib64\${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}

sudo vim /etc/profile
source /etc/profile

cat /etc/profile
echo $PATH

4.2 ~/.bashrc

~/.bashrc 文件添加环境设置。

# foreverstrong cuda-8.0
export PATH=/usr/local/cuda-8.0/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-8.0/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
# foreverstrong cuda-9.0
export PATH=/usr/local/cuda-9.0/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-9.0/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
# foreverstrong cuda-10.0
export PATH=/usr/local/cuda-10.0/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-10.0/lib64\${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}

sudo gedit ~/.bashrc
source ~/.bashrc

cat ~/.bashrc
echo $PATH

5. 信息查看

查看 GPU 驱动版本

deepnorth@deepnorth-amax:~$ cat /proc/driver/nvidia/version
NVRM version: NVIDIA UNIX x86_64 Kernel Module  430.14  Wed May  8 01:10:53 UTC 2019
GCC version:  gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.11)
deepnorth@deepnorth-amax:~$

CUDA 默认安装路径是 /usr/local/cuda-8.0、 /usr/local/cuda-9.0、/usr/local/cuda-10.0。/usr/local/cuda 是一个符号链接文件,指向 /usr/local/cuda-8.0、 /usr/local/cuda-9.0、/usr/local/cuda-10.0 文件夹。使用 ls -l 指令可以查看文件的链接关系。

deepnorth@deepnorth-amax:~$ ll /usr/local/
total 48
drwxr-xr-x 12 root root 4096 7月  11 19:44 ./
drwxr-xr-x 11 root root 4096 8月   1  2017 ../
drwxr-xr-x  2 root root 4096 7月   9 15:22 bin/
lrwxrwxrwx  1 root root   19 7月  10 11:06 cuda -> /usr/local/cuda-8.0/
drwxr-xr-x 19 root root 4096 7月  11 19:44 cuda-10.0/
drwxr-xr-x 17 root root 4096 7月  10 11:06 cuda-8.0/
drwxr-xr-x  2 root root 4096 8月   1  2017 etc/
drwxr-xr-x  2 root root 4096 8月   1  2017 games/
drwxr-xr-x  2 root root 4096 8月   1  2017 include/
drwxr-xr-x  4 root root 4096 8月   1  2017 lib/
lrwxrwxrwx  1 root root    9 7月   8 20:10 man -> share/man/
drwxr-xr-x  2 root root 4096 8月   1  2017 sbin/
drwxr-xr-x  8 root root 4096 8月   1  2017 share/
drwxr-xr-x  2 root root 4096 8月   1  2017 src/
deepnorth@deepnorth-amax:~$

6. Runfile Installer

Perform the following steps to install CUDA and verify the installation.
执行以下步骤以安装 CUDA 并验证安装。

  1. Disable the Nouveau drivers:
    Create a file at /etc/modprobe.d/blacklist-nouveau.conf with the following contents:
    在 /etc/modprobe.d/blacklist-nouveau.conf 中创建一个文件,其中包含以下内容:
blacklist nouveau
options nouveau modeset=0

Regenerate the kernel initramfs:

$ sudo update-initramfs -u
  1. Reboot into runlevel 3 by temporarily adding the number “3” and the word “nomodeset” to the end of the system’s kernel boot parameters.
    通过临时将数字 3 和单词 nomodeset 添加到系统内核引导参数的末尾,重新启动到运行级别 3。

  2. Run the installer silently to install with the default selections (implies acceptance of the EULA):
    以静默方式运行安装程序以使用默认选择进行安装 (意味着接受EULA):

sudo sh cuda_<version>_linux.run --silent
  1. Create an xorg.conf file to use the NVIDIA GPU for display:
    创建 xorg.conf 文件以使用 NVIDIA GPU 进行显示:
$ sudo nvidia-xconfig

If the GPU used for display is an NVIDIA GPU, the X server configuration file, /etc/X11/xorg.conf, may need to be modified. In some cases, nvidia-xconfig can be used to automatically generate a xorg.conf file that works for the system. For non-standard systems, such as those with more than one GPU, it is recommended to manually edit the xorg.conf file. Consult the xorg.conf documentation for more information.
如果用于显示的 GPU 是 NVIDIA GPU,则可能需要修改 X 服务器配置文件 /etc/X11/xorg.conf。在某些情况下,nvidia-xconfig 可用于自动生成适用于系统的 xorg.conf 文件。对于非标准系统,例如具有多个 GPU 的系统,建议手动编辑 xorg.conf 文件。有关更多信息,请参阅 xorg.conf 文档。

  1. Reboot the system to load the graphical interface.
    重新引导系统以加载图形界面。

  2. Set up the development environment by modifying the PATH and LD_LIBRARY_PATH variables:
    通过修改 PATH 和 LD_LIBRARY_PATH 变量来设置开发环境:

$ export PATH=/usr/local/cuda-10.0/bin${PATH:+:${PATH}}
$ export LD_LIBRARY_PATH=/usr/local/cuda-10.0/lib64\${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
  1. Install a writable copy of the samples then build and run the nbody sample:
$ cuda-install-samples-10.0.sh ~
$ cd ~/NVIDIA_CUDA-10.0_Samples/5_Simulations/nbody
$ make
$ ./nbody

References

https://docs.nvidia.com/cuda/archive/10.0/index.html

Ubuntu 16.04 安装 CUDA Toolkit 10.0相关推荐

  1. Ubuntu 16.04 安装 CUDA、CUDNN 和 GPU 版本的 TensorFlow 一般步骤总结

    1. 安装显卡驱动 安装显卡驱动网上有各种各样的方法,甚至有的还需要更改一些配置文件切换到命令行终端模式进行操作,然而就我多次安装驱动的经验来看,我从来没有这么费劲过.在 Ubuntu 系统中的 Sy ...

  2. 深度学习环境配置:ubuntu 16.04 安装2080ti驱动 cuda9.0和cudnn7.3 anaconda3.7 tensorflow12.0

    实验室配了2080ti,下面分享一下深度学习环境的搭建.在进行下面的操作前最好先安装好ssh,如果在安装驱动时出现循环登录的问题,还可以在另外的电脑上进行补救,配置过程也方便些. 该系统已经正常良好的 ...

  3. Ubuntu 16.04 安装 cuda 7.5.run BEGIN failed--compilation aborted at ./cuda-installer.pl line 5

    sudo apt install freeglut3-dev build-essential libx11-dev libxmu-dev \ libxi-dev libgl1-mesa-glx lib ...

  4. Ubuntu 18.04安装CUDA(版本10.2)和cuDNN

    1.系统要求 2.安装前的要求 3.runfile安装(不支持跨平台) 4.后续安装操作 5.安装cuDNN 6.汇总问题 本文基于Ubuntu 18.04.3 LTS 64位安装CUDA 10.2和 ...

  5. [NVIDIA] Ubuntu 16.04 安装 nvidia-384 + cuda-9.0

    租的腾讯云 GPU 主机,因为要安装 nvidia-384 + cuda-9.0,所以选择系统 Ubuntu 16.04. CUDA,NVIDIA Driver 之间的版本对应关系表格 文章目录 安装 ...

  6. Ubuntu 16.04配置CUDA 9.0+cudnn 7.0以及解决Nvidia显卡导致黑屏问题

    Ubuntu 16.04配置CUDA 9.0+cudnn 7.0以及解决Nvidia显卡导致黑屏问题 参考文章: (1)Ubuntu 16.04配置CUDA 9.0+cudnn 7.0以及解决Nvid ...

  7. Ubuntu 20.04安装CUDA失败导致系统黑屏消息nvidia 0000:01:00.0: can‘t change power state from D3cold to D0 的解决方法

    Ubuntu 20.04安装CUDA失败导致系统黑屏消息nvidia 0000:01:00.0: can't change power state from D3cold to D0 的解决方法 贺志 ...

  8. ROS_Kinetic_01 在 Ubuntu 16.04 安装ROS Kinetic 全教程附资料和镜像 2018.10.20更新

    Exbot易科机器人实验室新站点(测试中):http://server.blackant.org:23452/ 2018 ROS Melodic的迷失与救赎::https://blog.csdn.ne ...

  9. linux安装raw文件,Ubuntu 16.04安装图像处理软件 RawTherapee 5.0

    先介绍一下 RawTherapee,这是一款简单.实用的跨平台图像处理软件,快速.高效的帮助您处理所需图片工作.Raw 图像文件也越来越常见,有时候为了调整一下,不得不打开 Photoshop 来处理 ...

最新文章

  1. 联合权值 NOIP2014 提高组 Day1 T2
  2. antd中的form表单 initialValue导致数据不更新问题
  3. 爱上MVC~ajax调用分部视图session超时页面跳转问题
  4. cin,getline用法和不同
  5. 20144303 20145239 实验三 实时系统的移植
  6. 加拿大计算机语言学,加拿大语言学专业排名
  7. 消失了一周的小夕在玩什么啦?
  8. fpga如何约束走线_FPGA时序约束实战篇之多周期路径约束
  9. freeradius 3.0 时间限制_java锁之RateLimiter(限制访问速率)
  10. 并发控制技术手段之多版本(三)
  11. java中的各个数据结构区别
  12. 一文精讲Wireshark的抓包和分析
  13. jquery 库下载地址http://www.jq22.com/jquery-info122
  14. Basic Sensor Calibration (1) -- 加速计传感器校准
  15. SecureCRT 64位 安装破解版v8.1.4
  16. 基于C#和OpenVINO在英特尔独立显卡上部署PP-TinyPose模型
  17. JavaWeb-Servlet(上)
  18. Mac如何做才能彻底清理垃圾
  19. uniapp引入openLayers天地图
  20. python 3d绘图旋转_Python和Matplotlib:在Jupyter Noteb中使3D绘图具有交互性

热门文章

  1. 不知怎么选,用RFM模型看舔狗质量!
  2. Postman是什么 怎么用
  3. 【Jmeter】jmeter的安装与启动(win10)
  4. 数据结构视频知识点整理 1
  5. Linux安装数据库
  6. UDS-统一诊断服务
  7. 自媒体创作怎么细分领域?怎么进行选题?
  8. 【面试题】计算机网络常见面试题
  9. pandas 之 pivot_table 与 pivot 的区别
  10. vba访问服务器中txt文件,vba读取word内容 vba读取txt文件