欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Ubuntu16.04环境下深度学习环境配置

程序员文章站 2022-07-04 13:39:44
...

工作站硬件配置:

SuperMicro的SC747

CPU:

aaa@qq.com:~$ lscpu
Architecture:          x86_64
CPU op-mode(s):        32-bit, 64-bit
Byte Order:            Little Endian
CPU(s):                16
On-line CPU(s) list:   0-15
Thread(s) per core:    2
Core(s) per socket:    4
Socket(s):             2
NUMA node(s):          2
Vendor ID:             GenuineIntel
CPU family:            6
Model:                 79
Model name:            Intel(R) Xeon(R) CPU E5-2637 v4 @ 3.50GHz
Stepping:              1
CPU MHz:               1199.920
CPU max MHz:           3700.0000
CPU min MHz:           1200.0000
BogoMIPS:              6999.44
Virtualization:        VT-x
L1d cache:             32K
L1i cache:             32K
L2 cache:              256K
L3 cache:              15360K
NUMA node0 CPU(s):     0-3,8-11
NUMA node1 CPU(s):     4-7,12-15
Flags:                 fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch epb cat_l3 cdp_l3 intel_ppin intel_pt tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm cqm rdt_a rdseed adx smap xsaveopt cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local dtherm ida arat pln pts

一、安装Nivida显卡驱动

    1、查看nouveau驱动是否被禁用

    nouveau驱动是Ubuntu系统上面自带的驱动,要想使用NVIDIA的显卡驱动,必须先禁用掉Ubuntu自带的该nouveau驱动,禁用的具体操作参看参见https://www.jianshu.com/p/5b708817f5d8。因为该工作站之前配过开发环境,输入lsmod|grep nouveau命令进行查看确认即可:

aaa@qq.com:~$ lsmod |grep nouveau
aaa@qq.com:~$

    使用nano查看内核驱动参数的配置文件 /etc/modprobe.d/blacklist.conf:

aaa@qq.com:~$ sudo nano /etc/modprobe.d/blacklist.conf

Ubuntu16.04环境下深度学习环境配置

   最下面的blacklist等语句显示nouveau驱动已被成功屏蔽掉。

    2、添加NVIDIA显卡驱动的ppa库

    通过ppa的方式安装私有的NVIDIA显卡驱动,注意不要从NVIDIA官网下载驱动进行安装(姑且选择这种方法进行安装,不明白为什么):

aaa@qq.com:~$ sudo add-apt-repository ppa:graphics-drivers/ppa

 Fresh drivers from upstream, currently shipping Nvidia.

## Current Status

Current short-lived branch release: `nvidia-396` (396.24)
Dropped support for Fermi series (https://nvidia.custhelp.com/app/answers/detail/a_id/4656)

Current long-lived branch release: `nvidia-390` (390.48)
Old long-lived branch release: `nvidia-384` (384.130)

For G8x, G9x and GT2xx GPUs use `nvidia-340` (340.106)
For NV4x and G7x GPUs use `nvidia-304` (304.137) End-Of-Life!

Support timeframes for Unix legacy GPU releases:
https://nvidia.custhelp.com/app/answers/detail/a_id/3142

## What we're working on right now:

- Normal driver updates
- Help Wanted: Mesa Updates for Intel/AMD users, ping us if you want to help do this work, we're shorthanded.

## WARNINGS:

This PPA is currently in testing, you should be experienced with packaging before you dive in here:

Volunteers welcome! See also: https://github.com/mamarley/nvidia-graphics-drivers/

### How you can help:

## Install PTS and benchmark your gear:

    sudo apt-get install phoronix-test-suite

Run the benchmark:

    phoronix-test-suite default-benchmark openarena xonotic tesseract gputest unigine-valley

and then say yes when it asks you to submit your results to openbechmarking.org. Then grab a cup of coffee, it takes a bit for the benchmarks to run. Depending on the version of Ubuntu you're using it might preferable for you to grabs PTS from upstream directly: http://www.phoronix-test-suite.com/?k=downloads

## Share your results with the community:

Post a link to your results (or any other feedback to): https://launchpad.net/~graphics-drivers-testers

Remember to rerun and resubmit the benchmarks after driver upgrades, this will allow us to gather a bunch of data on performance that we can share with everybody.

If you run into old documentation referring to other PPAs, you can help us by consolidating references to this PPA.

If someone wants to go ahead and start prototyping on `software-properties-gtk` on what the GUI should look like, please start hacking!

## Help us Help You!

We use the donation funds to get the developers hardware to test and upload these drivers, please consider donating to the "community" slider on the donation page if you're loving this PPA:

http://www.ubuntu.com/download/desktop/contribute
 More info: https://launchpad.net/~graphics-drivers/+archive/ubuntu/ppa
Press [ENTER] to continue or ctrl-c to cancel adding it
gpg: keyring `/tmp/tmpwa1mbyh0/secring.gpg' created
gpg: keyring `/tmp/tmpwa1mbyh0/pubring.gpg' created
gpg: requesting key 1118213C from hkp server keyserver.ubuntu.com
gpg: /tmp/tmpwa1mbyh0/trustdb.gpg: trustdb created
gpg: key 1118213C: public key "Launchpad PPA for Graphics Drivers Team" imported
gpg: no ultimately trusted keys found
gpg: Total number processed: 1
gpg:               imported: 1  (RSA: 1)
OK
aaa@qq.com:~$
    update一下:
aaa@qq.com:~$ sudo apt-get update
Hit:1 http://mirrors.hust.edu.cn/ubuntu xenial InRelease
Get:2 http://mirrors.hust.edu.cn/ubuntu xenial-security InRelease [107 kB]
Get:3 http://mirrors.hust.edu.cn/ubuntu xenial-updates InRelease [109 kB]
Get:4 http://mirrors.hust.edu.cn/ubuntu xenial-proposed InRelease [258 kB]
Get:5 http://mirrors.hust.edu.cn/ubuntu xenial-backports InRelease [107 kB]
Get:6 http://mirrors.hust.edu.cn/ubuntu xenial-security/main amd64 DEP-11 Metada                               ta [67.7 kB]
Get:7 http://mirrors.hust.edu.cn/ubuntu xenial-security/main DEP-11 64x64 Icons                                [68.0 kB]
Get:8 http://mirrors.hust.edu.cn/ubuntu xenial-security/universe amd64 DEP-11 Me                               tadata [107 kB]
Get:9 http://mirrors.hust.edu.cn/ubuntu xenial-security/universe DEP-11 64x64 Ic                               ons [147 kB]
Get:10 http://mirrors.hust.edu.cn/ubuntu xenial-updates/main Sources [305 kB]
Get:11 http://mirrors.hust.edu.cn/ubuntu xenial-updates/main amd64 Packages [775                                kB]
Hit:12 http://ppa.launchpad.net/graphics-drivers/ppa/ubuntu xenial InRelease
Get:13 http://mirrors.hust.edu.cn/ubuntu xenial-updates/main i386 Packages [713                                kB]
Hit:14 http://linux.teamviewer.com/deb stable InRelease
Get:15 http://mirrors.hust.edu.cn/ubuntu xenial-updates/main amd64 DEP-11 Metada                               ta [319 kB]
Get:16 http://mirrors.hust.edu.cn/ubuntu xenial-updates/main DEP-11 64x64 Icons                                [224 kB]
Get:17 http://mirrors.hust.edu.cn/ubuntu xenial-updates/universe amd64 Packages                                [627 kB]
Hit:18 http://linux.teamviewer.com/deb preview InRelease
Hit:19 http://archive.ubuntu.com/ubuntu xenial InRelease
Get:20 http://mirrors.hust.edu.cn/ubuntu xenial-updates/universe i386 Packages [                               577 kB]
Get:21 http://mirrors.hust.edu.cn/ubuntu xenial-updates/universe amd64 DEP-11 Me                               tadata [246 kB]
Get:22 http://mirrors.hust.edu.cn/ubuntu xenial-updates/universe DEP-11 64x64 Ic                               ons [333 kB]
Get:23 http://mirrors.hust.edu.cn/ubuntu xenial-updates/multiverse amd64 DEP-11                                Metadata [5,964 B]
Get:24 http://mirrors.hust.edu.cn/ubuntu xenial-proposed/main amd64 DEP-11 Metad                               ata [6,984 B]
Get:25 http://mirrors.hust.edu.cn/ubuntu xenial-proposed/main DEP-11 64x64 Icons                                [4,066 B]
Get:26 http://mirrors.hust.edu.cn/ubuntu xenial-backports/main amd64 DEP-11 Meta                               data [3,324 B]
Get:27 http://mirrors.hust.edu.cn/ubuntu xenial-backports/universe amd64 DEP-11                                Metadata [5,092 B]
Get:28 http://archive.ubuntu.com/ubuntu xenial-security InRelease [107 kB]
Hit:29 http://ppa.launchpad.net/notepadqq-team/notepadqq/ubuntu xenial InRelease
Hit:30 http://ppa.launchpad.net/webupd8team/java/ubuntu xenial InRelease
Hit:31 http://ppa.launchpad.net/xorg-edgers/ppa/ubuntu xenial InRelease
Get:32 http://archive.ubuntu.com/ubuntu xenial-updates InRelease [109 kB]
Get:33 http://archive.ubuntu.com/ubuntu xenial-backports InRelease [107 kB]
Get:34 http://archive.ubuntu.com/ubuntu xenial-proposed InRelease [258 kB]
Get:35 http://archive.ubuntu.com/ubuntu xenial-security/main amd64 DEP-11 Metada                               ta [67.7 kB]
Get:36 http://archive.ubuntu.com/ubuntu xenial-security/main DEP-11 64x64 Icons                                [68.0 kB]
Get:37 http://archive.ubuntu.com/ubuntu xenial-security/universe amd64 DEP-11 Me                               tadata [107 kB]
Get:38 http://archive.ubuntu.com/ubuntu xenial-security/universe DEP-11 64x64 Ic                               ons [147 kB]
Get:39 http://archive.ubuntu.com/ubuntu xenial-updates/main Sources [305 kB]
Get:40 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages [775                                kB]
Get:41 http://archive.ubuntu.com/ubuntu xenial-updates/main i386 Packages [713 k                               B]
Get:42 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 DEP-11 Metadat                               a [319 kB]
Get:43 http://archive.ubuntu.com/ubuntu xenial-updates/main DEP-11 64x64 Icons [                               229 kB]
Get:44 http://archive.ubuntu.com/ubuntu xenial-updates/universe amd64 Packages [                               627 kB]
Get:45 http://archive.ubuntu.com/ubuntu xenial-updates/universe i386 Packages [5                               77 kB]
Get:46 http://archive.ubuntu.com/ubuntu xenial-updates/universe amd64 DEP-11 Met                               adata [246 kB]
Get:47 http://archive.ubuntu.com/ubuntu xenial-updates/universe DEP-11 64x64 Ico                               ns [331 kB]
Get:48 http://archive.ubuntu.com/ubuntu xenial-updates/multiverse amd64 DEP-11 M                               etadata [5,964 B]
Get:49 http://archive.ubuntu.com/ubuntu xenial-backports/main amd64 DEP-11 Metad                               ata [3,324 B]
Get:50 http://archive.ubuntu.com/ubuntu xenial-backports/universe amd64 DEP-11 M                               etadata [5,092 B]
Get:51 http://archive.ubuntu.com/ubuntu xenial-proposed/main amd64 DEP-11 Metada                               ta [6,984 B]
Get:52 http://archive.ubuntu.com/ubuntu xenial-proposed/main DEP-11 64x64 Icons                                [4,066 B]
Fetched 10.2 MB in 37s (274 kB/s)
Reading package lists... Done
aaa@qq.com:~$

    查看一下NVIDIA驱动的版本:

aaa@qq.com:~$ sudo apt-get install nvidia-3
nvidia-304              nvidia-340              nvidia-352              nvidia-375
nvidia-304-dev          nvidia-340-dev          nvidia-352-dev          nvidia-375-dev
nvidia-304-updates      nvidia-340-updates      nvidia-352-updates      nvidia-384
nvidia-304-updates-dev  nvidia-340-updates-dev  nvidia-352-updates-dev  nvidia-384-dev
nvidia-331              nvidia-340-updates-uvm  nvidia-361              nvidia-387
nvidia-331-dev          nvidia-340-uvm          nvidia-361-dev          nvidia-387-dev
nvidia-331-updates      nvidia-346              nvidia-361-updates      nvidia-390
nvidia-331-updates-dev  nvidia-346-dev          nvidia-361-updates-dev  nvidia-390-dev
nvidia-331-updates-uvm  nvidia-346-updates      nvidia-367              nvidia-396
nvidia-331-uvm          nvidia-346-updates-dev  nvidia-367-dev          nvidia-396-dev

    选择长期支持版的nivida的390.48进行安装:

aaa@qq.com:~$ sudo apt-get install nvidia-390
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
  linux-headers-4.4.0-116 linux-headers-4.4.0-116-generic linux-image-4.4.0-116-generic
  linux-image-extra-4.4.0-116-generic linux-signed-image-4.4.0-116-generic
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  bbswitch-dkms dkms lib32gcc1 libc6-i386 libcuda1-390 libjansson4 libvdpau1 libxnvctrl0 mesa-vdpau-drivers
  nvidia-opencl-icd-390 nvidia-prime nvidia-settings screen-resolution-extra vdpau-driver-all
  xserver-xorg-legacy
Suggested packages:
  bumblebee libvdpau-va-gl1 nvidia-vdpau-driver nvidia-legacy-340xx-vdpau-driver
The following NEW packages will be installed:
  bbswitch-dkms dkms lib32gcc1 libc6-i386 libcuda1-390 libjansson4 libvdpau1 libxnvctrl0 mesa-vdpau-drivers
  nvidia-390 nvidia-opencl-icd-390 nvidia-prime nvidia-settings screen-resolution-extra vdpau-driver-all
  xserver-xorg-legacy
0 upgraded, 16 newly installed, 0 to remove and 15 not upgraded.
Need to get 0 B/86.1 MB of archives.
After this operation, 398 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Preconfiguring packages ...
setting xserver-xorg-legacy/xwrapper/allowed_users from configuration file
Selecting previously unselected package dkms.
(Reading database ... 266103 files and directories currently installed.)
Preparing to unpack .../dkms_2.2.0.3-2ubuntu11.5_all.deb ...
Unpacking dkms (2.2.0.3-2ubuntu11.5) ...
Selecting previously unselected package libc6-i386.
Preparing to unpack .../libc6-i386_2.23-0ubuntu10_amd64.deb ...
Unpacking libc6-i386 (2.23-0ubuntu10) ...
Selecting previously unselected package lib32gcc1.
Preparing to unpack .../lib32gcc1_1%3a6.0.1-0ubuntu1_amd64.deb ...
Unpacking lib32gcc1 (1:6.0.1-0ubuntu1) ...
Selecting previously unselected package xserver-xorg-legacy.
Preparing to unpack .../xserver-xorg-legacy_2%3a1.18.4-0ubuntu0.7_amd64.deb ...
Unpacking xserver-xorg-legacy (2:1.18.4-0ubuntu0.7) ...
Selecting previously unselected package nvidia-390.
Preparing to unpack .../nvidia-390_390.48-0ubuntu0~gpu16.04.3_amd64.deb ...
Unpacking nvidia-390 (390.48-0ubuntu0~gpu16.04.3) ...
Selecting previously unselected package libcuda1-390.
Preparing to unpack .../libcuda1-390_390.48-0ubuntu0~gpu16.04.3_amd64.deb ...
Unpacking libcuda1-390 (390.48-0ubuntu0~gpu16.04.3) ...
Selecting previously unselected package libjansson4:amd64.
Preparing to unpack .../libjansson4_2.7-3_amd64.deb ...
Unpacking libjansson4:amd64 (2.7-3) ...
Selecting previously unselected package libvdpau1:amd64.
Preparing to unpack .../libvdpau1_1.1.1-3ubuntu1_amd64.deb ...
Unpacking libvdpau1:amd64 (1.1.1-3ubuntu1) ...
Selecting previously unselected package libxnvctrl0:amd64.
Preparing to unpack .../libxnvctrl0_396.24-0ubuntu0~gpu16.04.1_amd64.deb ...
Unpacking libxnvctrl0:amd64 (396.24-0ubuntu0~gpu16.04.1) ...
Selecting previously unselected package mesa-vdpau-drivers:amd64.
Preparing to unpack .../mesa-vdpau-drivers_18.0.0~git20180214+18.0.1e173463-0ubuntu0ricotz~16.04.1_amd64.deb ...
Unpacking mesa-vdpau-drivers:amd64 (18.0.0~git20180214+18.0.1e173463-0ubuntu0ricotz~16.04.1) ...
Selecting previously unselected package nvidia-opencl-icd-390.
Preparing to unpack .../nvidia-opencl-icd-390_390.48-0ubuntu0~gpu16.04.3_amd64.deb ...
Unpacking nvidia-opencl-icd-390 (390.48-0ubuntu0~gpu16.04.3) ...
Selecting previously unselected package bbswitch-dkms.
Preparing to unpack .../bbswitch-dkms_0.8-3ubuntu1_amd64.deb ...
Unpacking bbswitch-dkms (0.8-3ubuntu1) ...
Selecting previously unselected package nvidia-prime.
Preparing to unpack .../nvidia-prime_0.8.2_amd64.deb ...
Unpacking nvidia-prime (0.8.2) ...
Selecting previously unselected package screen-resolution-extra.
Preparing to unpack .../screen-resolution-extra_0.17.1.1~16.04.1_all.deb ...
Unpacking screen-resolution-extra (0.17.1.1~16.04.1) ...
Selecting previously unselected package nvidia-settings.
Preparing to unpack .../nvidia-settings_396.24-0ubuntu0~gpu16.04.1_amd64.deb ...
Unpacking nvidia-settings (396.24-0ubuntu0~gpu16.04.1) ...
Selecting previously unselected package vdpau-driver-all:amd64.
Preparing to unpack .../vdpau-driver-all_1.1.1-3ubuntu1_amd64.deb ...
Unpacking vdpau-driver-all:amd64 (1.1.1-3ubuntu1) ...
Processing triggers for man-db (2.7.5-1) ...
Processing triggers for libc-bin (2.23-0ubuntu10) ...
Processing triggers for ureadahead (0.100.0-19) ...
ureadahead will be reprofiled on next reboot
Processing triggers for dbus (1.10.6-1ubuntu3.3) ...
Processing triggers for bamfdaemon (0.5.3~bzr0+16.04.20180209-0ubuntu1) ...
Rebuilding /usr/share/applications/bamf-2.index...
Processing triggers for gnome-menus (3.13.3-6ubuntu3.1) ...
Processing triggers for desktop-file-utils (0.22-1ubuntu5.1) ...
Processing triggers for mime-support (3.59ubuntu1) ...
Setting up dkms (2.2.0.3-2ubuntu11.5) ...
Setting up libc6-i386 (2.23-0ubuntu10) ...
Setting up lib32gcc1 (1:6.0.1-0ubuntu1) ...
Setting up xserver-xorg-legacy (2:1.18.4-0ubuntu0.7) ...
setting xserver-xorg-legacy/xwrapper/allowed_users from configuration file
Setting up nvidia-390 (390.48-0ubuntu0~gpu16.04.3) ...
update-alternatives: using /usr/lib/nvidia-390/ld.so.conf to provide /etc/ld.so.conf.d/x86_64-linux-gnu_GL.conf (x86_64-linux-gnu_gl_conf) in auto mode
update-alternatives: using /usr/lib/nvidia-390/ld.so.conf to provide /etc/ld.so.conf.d/x86_64-linux-gnu_EGL.conf (x86_64-linux-gnu_egl_conf) in auto mode
update-alternatives: using /usr/lib/nvidia-390/alt_ld.so.conf to provide /etc/ld.so.conf.d/i386-linux-gnu_GL.conf (i386-linux-gnu_gl_conf) in auto mode
update-alternatives: using /usr/lib/nvidia-390/alt_ld.so.conf to provide /etc/ld.so.conf.d/i386-linux-gnu_EGL.conf (i386-linux-gnu_egl_conf) in auto mode
update-alternatives: using /usr/share/nvidia-390/glamor.conf to provide /usr/share/X11/xorg.conf.d/glamoregl.conf (glamor_conf) in auto mode
update-initramfs: deferring update (trigger activated)
INFO:Enable nvidia-390
DEBUG:Parsing /usr/share/ubuntu-drivers-common/quirks/lenovo_thinkpad
DEBUG:Parsing /usr/share/ubuntu-drivers-common/quirks/put_your_quirks_here
DEBUG:Parsing /usr/share/ubuntu-drivers-common/quirks/dell_latitude
Adding system user `nvidia-persistenced' (UID 122) ...
Adding new group `nvidia-persistenced' (GID 129) ...
Adding new user `nvidia-persistenced' (UID 122) with group `nvidia-persistenced' ...
Not creating home directory `/'.
Loading new nvidia-390-390.48 DKMS files...
Building only for 4.10.0-28-generic
Building for architecture x86_64
Module build for the currently running kernel was skipped since the
kernel source for this kernel does not seem to be installed.
Setting up libcuda1-390 (390.48-0ubuntu0~gpu16.04.3) ...
Setting up libjansson4:amd64 (2.7-3) ...
Setting up libvdpau1:amd64 (1.1.1-3ubuntu1) ...
Setting up libxnvctrl0:amd64 (396.24-0ubuntu0~gpu16.04.1) ...
Setting up mesa-vdpau-drivers:amd64 (18.0.0~git20180214+18.0.1e173463-0ubuntu0ricotz~16.04.1) ...
Setting up nvidia-opencl-icd-390 (390.48-0ubuntu0~gpu16.04.3) ...
Setting up bbswitch-dkms (0.8-3ubuntu1) ...
Loading new bbswitch-0.8 DKMS files...
First Installation: checking all kernels...
Building only for 4.10.0-28-generic
Module build for the currently running kernel was skipped since the
kernel source for this kernel does not seem to be installed.
Setting up nvidia-prime (0.8.2) ...
Setting up screen-resolution-extra (0.17.1.1~16.04.1) ...
Setting up nvidia-settings (396.24-0ubuntu0~gpu16.04.1) ...
Setting up vdpau-driver-all:amd64 (1.1.1-3ubuntu1) ...
Processing triggers for libc-bin (2.23-0ubuntu10) ...
Processing triggers for initramfs-tools (0.122ubuntu8.11) ...
update-initramfs: Generating /boot/initrd.img-4.10.0-28-generic
W: Possible missing firmware /lib/firmware/ast_dp501_fw.bin for module ast
Processing triggers for shim-signed (1.33.1~16.04.1+13-0ubuntu2) ...
Secure Boot not enabled on this system.
aaa@qq.com:~$ ^C
aaa@qq.com:~$
    再输入sudo apt-get install nvidia-390显示已经成功安装:
aaa@qq.com:~$ sudo apt-get install nvidia-390
Reading package lists... Done
Building dependency tree
Reading state information... Done
nvidia-390 is already the newest version (390.48-0ubuntu0~gpu16.04.3).
The following packages were automatically installed and are no longer required:
  linux-headers-4.4.0-116 linux-headers-4.4.0-116-generic linux-image-4.4.0-116-generic
  linux-image-extra-4.4.0-116-generic linux-signed-image-4.4.0-116-generic
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 15 not upgraded.

二、安装CUDA

    参照nvida中文论坛给的教程和20180418和20180425两次线上的关于tensorRT平台的分享。

    1、下载cuda

aaa@qq.com:~$ ls
anaconda3  Documents  examples.desktop  LYH                          Music      Pictures  Templates  Videos
Desktop    Downloads  LightGBM          mentohust_0.3.4-1_amd64.deb  nohup.out  Public    tools
aaa@qq.com:~$ cd Downloads/
aaa@qq.com:~/Downloads$ wget http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/cuda-repo-ubuntu1604_9.0.176-1_amd64.deb
--2018-05-18 21:19:22--  http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/cuda-repo-ubuntu1604_9.0.176-1_amd64.deb
Resolving developer.download.nvidia.com (developer.download.nvidia.com)... 14.152.90.216, 58.223.168.57, 115.238.195.152, ...
Connecting to developer.download.nvidia.com (developer.download.nvidia.com)|14.152.90.216|:80... connected.
HTTP request sent, awaiting response... 302 Found
Location: http://114.80.80.238:8089/ceshi/index.html [following]
--2018-05-18 21:19:23--  http://114.80.80.238:8089/ceshi/index.html
Connecting to 114.80.80.238:8089... connected.
HTTP request sent, awaiting response... 200 OK
Length: 691 [text/html]
Saving to: ‘cuda-repo-ubuntu1604_9.0.176-1_amd64.deb’

cuda-repo-ubuntu1604_9.0.17 100%[==========================================>]     691  --.-KB/s    in 0s

2018-05-18 21:19:24 (70.0 MB/s) - ‘cuda-repo-ubuntu1604_9.0.176-1_amd64.deb’ saved [691/691]
    2、安装cuda
aaa@qq.com:~/Downloads$ sudo dpkg -i cuda-repo-ubuntu1604_9.0.176-1_amd64.deb
dpkg-deb: error: 'cuda-repo-ubuntu1604_9.0.176-1_amd64.deb' is not a debian format archive
dpkg: error processing archive cuda-repo-ubuntu1604_9.0.176-1_amd64.deb (--install):
 subprocess dpkg-deb --control returned error exit status 2
Errors were encountered while processing:
 cuda-repo-ubuntu1604_9.0.176-1_amd64.deb
aaa@qq.com:~/Downloads$ ls -l
total 4
-rw-rw-r-- 1 yuhuiliu yuhuiliu 691 5月  18 21:19 cuda-repo-ubuntu1604_9.0.176-1_amd64.deb

    安装失败,显示在processing deb文件时候发生了Errors。使用ls -l命令查看cuda安装文件的大小,发现大小为691K,可以这么小的安装包应该是个在线安装包。联想到晚上在知乎正好看的帖子,nvida的官网没有在工信部备案被服务商屏蔽掉了服务。

    这时在网页上尝试打开链接

http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/cuda-repo-ubuntu1604_9.0.176-1_amd64.deb
    跳转到如下链接:http://114.80.80.238:8089/ceshi/index.html,出现了如下结果:
Ubuntu16.04环境下深度学习环境配置
    参照https://blog.csdn.net/qq_35976351/article/details/79325476   cuda-repo-ubuntu1604_9.0.176-1_amd64.deb,重新下载本地版本安装。

     CUDA9.0本地下载地址:https://developer.nvidia.com/cuda-90-download-archive?target_os=Linux&target_arch=x86_64&target_distro=Ubuntu&target_version=1604&target_type=deblocal,注意下载提示的界面上不光有local版本还有network版本,一定要选择local版本进行下载。

      下载如下图对应的cuda-repo-ubuntu1604-9-0-local_9.0.176-1_amd64.deb以及对应的两个patch

Ubuntu16.04环境下深度学习环境配置

aaa@qq.cominclab-desktop:~/Downloads$ wget  https://developer.nvidia.com/compute/cuda/9.0/Prod/patches/1/cuda-repo-ubuntu1604-9-0-local-cublas-performance-update_1.0-1_amd64-deb  https://developer.nvidia.com/compute/cuda/9.0/Prod/patches/2/cuda-repo-ubuntu1604-9-0-local-cublas-performance-update-2_1.0-1_amd64-deb
--2018-05-18 22:09:01--  https://developer.nvidia.com/compute/cuda/9.0/Prod/patches/1/cuda-repo-ubuntu1604-9-0-local-cublas-performance-update_1.0-1_amd64-deb
Resolving developer.nvidia.com (developer.nvidia.com)... 183.214.10.142, 183.214.10.141
Connecting to developer.nvidia.com (developer.nvidia.com)|183.214.10.142|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://developer.download.nvidia.com/compute/cuda/9.0/secure/Prod/patches/1/cuda-repo-ubuntu1604-9-0-local-cublas-performance-update_1.0-1_amd64.deb?h0k2dgbzkKhzEoI7-lCuSNy7msvmFGNy8ndbftccfIZmypKqoCfZgVgoyKypI7qgZfhGz_ra2uoEi_VpTxgti6rDSHIOuyf5taw_zlHEfBwhu0Kfs-RxyPPYs-4S1_WnXcfqN3l0dfRyfNV0aQz61rBEukZPMNpwJdYciR0iBtJPtlZ_HZhrCTMz6r2Y8fkPfTNVQoJLGno3Ykb6bPNwhK9mEk5DDfqpuXDe9n35 [following]
--2018-05-18 22:09:03--  https://developer.download.nvidia.com/compute/cuda/9.0/secure/Prod/patches/1/cuda-repo-ubuntu1604-9-0-local-cublas-performance-update_1.0-1_amd64.deb?h0k2dgbzkKhzEoI7-lCuSNy7msvmFGNy8ndbftccfIZmypKqoCfZgVgoyKypI7qgZfhGz_ra2uoEi_VpTxgti6rDSHIOuyf5taw_zlHEfBwhu0Kfs-RxyPPYs-4S1_WnXcfqN3l0dfRyfNV0aQz61rBEukZPMNpwJdYciR0iBtJPtlZ_HZhrCTMz6r2Y8fkPfTNVQoJLGno3Ykb6bPNwhK9mEk5DDfqpuXDe9n35
Resolving developer.download.nvidia.com (developer.download.nvidia.com)... 183.214.10.142, 183.214.10.141
Connecting to developer.download.nvidia.com (developer.download.nvidia.com)|183.214.10.142|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 100157250 (96M) [application/x-deb]
Saving to: ‘cuda-repo-ubuntu1604-9-0-local-cublas-performance-update_1.0-1_amd64-deb’

cuda-repo-ubuntu1604-9-0-lo 100%[==========================================>]  95.52M  1.71MB/s    in 56s

2018-05-18 22:09:59 (1.71 MB/s) - ‘cuda-repo-ubuntu1604-9-0-local-cublas-performance-update_1.0-1_amd64-deb’ saved [100157250/100157250]

--2018-05-18 22:09:59--  https://developer.nvidia.com/compute/cuda/9.0/Prod/patches/2/cuda-repo-ubuntu1604-9-0-local-cublas-performance-update-2_1.0-1_amd64-deb
Connecting to developer.nvidia.com (developer.nvidia.com)|183.214.10.142|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://developer.download.nvidia.com/compute/cuda/9.0/secure/Prod/patches/2/cuda-repo-ubuntu1604-9-0-local-cublas-performance-update-2_1.0-1_amd64.deb?aco1OoR_sMeW7utgu0oCrzD4h6z2O0s_yQU1f_r_hb_W-akggEwPmoWlSNbHZQmuZU3Dwluphwm19rzJuSFyDXFo6E4iLgFIigjPxSE8osfHz19kVEG5bmbJOkYIX8FNOk8O4jEUxlLiV8ynB7695Sh9CqcoqE9u6o4u8WTxqejZz5rxO28zYnKNhEYeWRmzYYz4Ulk6iGIuR55SX0dWw3lLEehm6uTpMfr7AIofbAQ [following]
--2018-05-18 22:10:00--  https://developer.download.nvidia.com/compute/cuda/9.0/secure/Prod/patches/2/cuda-repo-ubuntu1604-9-0-local-cublas-performance-update-2_1.0-1_amd64.deb?aco1OoR_sMeW7utgu0oCrzD4h6z2O0s_yQU1f_r_hb_W-akggEwPmoWlSNbHZQmuZU3Dwluphwm19rzJuSFyDXFo6E4iLgFIigjPxSE8osfHz19kVEG5bmbJOkYIX8FNOk8O4jEUxlLiV8ynB7695Sh9CqcoqE9u6o4u8WTxqejZz5rxO28zYnKNhEYeWRmzYYz4Ulk6iGIuR55SX0dWw3lLEehm6uTpMfr7AIofbAQ
Connecting to developer.download.nvidia.com (developer.download.nvidia.com)|183.214.10.142|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 100020356 (95M) [application/x-deb]
Saving to: ‘cuda-repo-ubuntu1604-9-0-local-cublas-performance-update-2_1.0-1_amd64-deb’

cuda-repo-ubuntu1604-9-0-lo 100%[==========================================>]  95.39M  1.71MB/s    in 56s

2018-05-18 22:10:57 (1.70 MB/s) - ‘cuda-repo-ubuntu1604-9-0-local-cublas-performance-update-2_1.0-1_amd64-deb’ saved [100020356/100020356]

FINISHED --2018-05-18 22:10:57--
Total wall clock time: 1m 56s
Downloaded: 2 files, 191M in 1m 52s (1.70 MB/s)
aaa@qq.com:~/Downloads$ ls -l
total 1379820
-rw-rw-r-- 1 yuhuiliu yuhuiliu        691 5月  18 21:19 cuda-repo-ubuntu1604_9.0.176-1_amd64.deb
-rw-rw-r-- 1 yuhuiliu yuhuiliu        691 5月  18 21:55 cuda-repo-ubuntu1604_9.0.176-1_amd64.deb.1
-rw-rw-r-- 1 yuhuiliu yuhuiliu 1212738714 9月  23  2017 cuda-repo-ubuntu1604-9-0-local_9.0.176-1_amd64-deb
-rw-rw-r-- 1 yuhuiliu yuhuiliu  100157250 12月 21 03:02 cuda-repo-ubuntu1604-9-0-local-cublas-performance-update_1.0-1_amd64-deb
-rw-rw-r-- 1 yuhuiliu yuhuiliu  100020356 2月  15 03:43 cuda-repo-ubuntu1604-9-0-local-cublas-performance-update-2_1.0-1_amd64-deb
aaa@qq.com:~/Downloads$
    删掉不用的文件:
aaa@qq.com:~/Downloads$ sudo rm cuda-repo-ubuntu1604_9.0.176-1_amd64.deb cuda-repo-ubuntu1604_9.0.176-1_amd64.deb.1
[sudo] password for yuhuiliu:
aaa@qq.com:~/Downloads$
    安装说明依次输入:
  1. `sudo dpkg -i cuda-repo-ubuntu1604-9-0-local_9.0.176-1_amd64.deb`
  2. `sudo apt-key add /var/cuda-repo-<version>/7fa2af80.pub`
  3. `sudo apt-get update`
  4. `sudo apt-get install cuda`
aaa@qq.com:~/Downloads$ sudo apt-get install cud
cuda                            cuda-cusolver-dev-9-0           cuda-npp-9-0
cuda-9-0                        cuda-cusparse-9-0               cuda-npp-dev-9-0
cuda-command-line-tools-9-0     cuda-cusparse-dev-9-0           cuda-nvgraph-9-0
cuda-core-9-0                   cuda-demo-suite-9-0             cuda-nvgraph-dev-9-0
cuda-cublas-9-0                 cuda-documentation-9-0          cuda-nvml-dev-9-0
cuda-cublas-dev-9-0             cuda-driver-dev-9-0             cuda-nvrtc-9-0
cuda-cudart-9-0                 cuda-drivers                    cuda-nvrtc-dev-9-0
cuda-cudart-dev-9-0             cuda-gdb-src-9-0                cuda-repo-ubuntu1604-9-0-local
cuda-cufft-9-0                  cuda-libraries-9-0              cuda-runtime-9-0
cuda-cufft-dev-9-0              cuda-libraries-dev-9-0          cuda-samples-9-0
cuda-curand-9-0                 cuda-license-9-0                cuda-toolkit-9-0
cuda-curand-dev-9-0             cuda-minimal-build-9-0          cuda-visual-tools-9-0
cuda-cusolver-9-0               cuda-misc-headers-9-0           cudf-tools
aaa@qq.com:~/Downloads$ sudo apt-get install cuda
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
  linux-headers-4.4.0-116 linux-headers-4.4.0-116-generic linux-image-4.4.0-116-generic
  linux-image-extra-4.4.0-116-generic linux-signed-image-4.4.0-116-generic
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  cuda-9-0 cuda-command-line-tools-9-0 cuda-core-9-0 cuda-cublas-9-0 cuda-cublas-dev-9-0 cuda-cudart-9-0
  cuda-cudart-dev-9-0 cuda-cufft-9-0 cuda-cufft-dev-9-0 cuda-curand-9-0 cuda-curand-dev-9-0 cuda-cusolver-9-0
  cuda-cusolver-dev-9-0 cuda-cusparse-9-0 cuda-cusparse-dev-9-0 cuda-demo-suite-9-0 cuda-documentation-9-0
  cuda-driver-dev-9-0 cuda-drivers cuda-libraries-9-0 cuda-libraries-dev-9-0 cuda-license-9-0
  cuda-misc-headers-9-0 cuda-npp-9-0 cuda-npp-dev-9-0 cuda-nvgraph-9-0 cuda-nvgraph-dev-9-0 cuda-nvml-dev-9-0
  cuda-nvrtc-9-0 cuda-nvrtc-dev-9-0 cuda-runtime-9-0 cuda-samples-9-0 cuda-toolkit-9-0 cuda-visual-tools-9-0
  libcuda1-384 nvidia-384 nvidia-384-dev nvidia-modprobe nvidia-opencl-icd-384
The following packages will be REMOVED:
  libcuda1-390 nvidia-390 nvidia-opencl-icd-390
The following NEW packages will be installed:
  cuda cuda-9-0 cuda-command-line-tools-9-0 cuda-core-9-0 cuda-cublas-9-0 cuda-cublas-dev-9-0 cuda-cudart-9-0
  cuda-cudart-dev-9-0 cuda-cufft-9-0 cuda-cufft-dev-9-0 cuda-curand-9-0 cuda-curand-dev-9-0 cuda-cusolver-9-0
  cuda-cusolver-dev-9-0 cuda-cusparse-9-0 cuda-cusparse-dev-9-0 cuda-demo-suite-9-0 cuda-documentation-9-0
  cuda-driver-dev-9-0 cuda-drivers cuda-libraries-9-0 cuda-libraries-dev-9-0 cuda-license-9-0
  cuda-misc-headers-9-0 cuda-npp-9-0 cuda-npp-dev-9-0 cuda-nvgraph-9-0 cuda-nvgraph-dev-9-0 cuda-nvml-dev-9-0
  cuda-nvrtc-9-0 cuda-nvrtc-dev-9-0 cuda-runtime-9-0 cuda-samples-9-0 cuda-toolkit-9-0 cuda-visual-tools-9-0
  libcuda1-384 nvidia-384 nvidia-384-dev nvidia-modprobe nvidia-opencl-icd-384
0 upgraded, 40 newly installed, 3 to remove and 15 not upgraded.
Need to get 80.3 MB/1,177 MB of archives.
After this operation, 2,317 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 file:/var/cuda-repo-9-0-local  cuda-license-9-0 9.0.176-1 [22.0 kB]
Get:2 file:/var/cuda-repo-9-0-local  cuda-misc-headers-9-0 9.0.176-1 [684 kB]
Get:3 file:/var/cuda-repo-9-0-local  cuda-core-9-0 9.0.176-1 [16.9 MB]
Get:4 file:/var/cuda-repo-9-0-local  cuda-cudart-9-0 9.0.176-1 [106 kB]
Get:5 file:/var/cuda-repo-9-0-local  cuda-driver-dev-9-0 9.0.176-1 [10.9 kB]
Get:6 file:/var/cuda-repo-9-0-local  cuda-cudart-dev-9-0 9.0.176-1 [767 kB]
Get:7 file:/var/cuda-repo-9-0-local  cuda-command-line-tools-9-0 9.0.176-1 [25.4 MB]
Get:8 file:/var/cuda-repo-9-0-local  cuda-nvrtc-9-0 9.0.176-1 [6,348 kB]
Get:9 file:/var/cuda-repo-9-0-local  cuda-nvrtc-dev-9-0 9.0.176-1 [9,334 B]
Get:10 http://ppa.launchpad.net/graphics-drivers/ppa/ubuntu xenial/main amd64 nvidia-384 amd64 384.130-0ubuntu0~gpu16.04.1 [73.1 MB]
Get:11 file:/var/cuda-repo-9-0-local  cuda-cusolver-9-0 9.0.176-1 [26.2 MB]
Get:12 file:/var/cuda-repo-9-0-local  cuda-cusolver-dev-9-0 9.0.176-1 [5,317 kB]
Get:13 file:/var/cuda-repo-9-0-local  cuda-cublas-9-0 9.0.176-1 [25.0 MB]
Get:14 file:/var/cuda-repo-9-0-local  cuda-cublas-dev-9-0 9.0.176-1 [49.4 MB]
Get:15 file:/var/cuda-repo-9-0-local  cuda-cufft-9-0 9.0.176-1 [84.1 MB]
Get:16 file:/var/cuda-repo-9-0-local  cuda-cufft-dev-9-0 9.0.176-1 [73.7 MB]
Get:17 file:/var/cuda-repo-9-0-local  cuda-curand-9-0 9.0.176-1 [38.8 MB]
Get:18 file:/var/cuda-repo-9-0-local  cuda-curand-dev-9-0 9.0.176-1 [57.9 MB]
Get:19 file:/var/cuda-repo-9-0-local  cuda-cusparse-9-0 9.0.176-1 [25.2 MB]
Get:20 file:/var/cuda-repo-9-0-local  cuda-cusparse-dev-9-0 9.0.176-1 [25.3 MB]
Get:21 file:/var/cuda-repo-9-0-local  cuda-npp-9-0 9.0.176-1 [46.6 MB]
Get:22 file:/var/cuda-repo-9-0-local  cuda-npp-dev-9-0 9.0.176-1 [46.6 MB]
Get:23 file:/var/cuda-repo-9-0-local  cuda-nvgraph-9-0 9.0.176-1 [6,081 kB]
Get:24 file:/var/cuda-repo-9-0-local  cuda-nvgraph-dev-9-0 9.0.176-1 [5,658 kB]
Get:25 file:/var/cuda-repo-9-0-local  cuda-samples-9-0 9.0.176-1 [75.9 MB]
Get:26 file:/var/cuda-repo-9-0-local  cuda-documentation-9-0 9.0.176-1 [53.1 MB]
Get:27 file:/var/cuda-repo-9-0-local  cuda-libraries-dev-9-0 9.0.176-1 [2,596 B]
Get:28 file:/var/cuda-repo-9-0-local  cuda-nvml-dev-9-0 9.0.176-1 [47.6 kB]
Get:29 file:/var/cuda-repo-9-0-local  cuda-visual-tools-9-0 9.0.176-1 [398 MB]
Get:30 file:/var/cuda-repo-9-0-local  cuda-toolkit-9-0 9.0.176-1 [2,836 B]
Get:31 file:/var/cuda-repo-9-0-local  nvidia-modprobe 384.81-0ubuntu1 [17.1 kB]
Get:32 file:/var/cuda-repo-9-0-local  cuda-drivers 384.81-1 [2,398 B]
Get:33 file:/var/cuda-repo-9-0-local  cuda-libraries-9-0 9.0.176-1 [2,566 B]
Get:34 file:/var/cuda-repo-9-0-local  cuda-runtime-9-0 9.0.176-1 [2,526 B]
Get:35 file:/var/cuda-repo-9-0-local  cuda-demo-suite-9-0 9.0.176-1 [3,880 kB]
Get:36 file:/var/cuda-repo-9-0-local  cuda-9-0 9.0.176-1 [2,552 B]
Get:37 file:/var/cuda-repo-9-0-local  cuda 9.0.176-1 [2,504 B]
Get:38 http://ppa.launchpad.net/graphics-drivers/ppa/ubuntu xenial/main amd64 nvidia-384-dev amd64 384.130-0ubuntu0~gpu16.04.1 [81.6 kB]
Get:39 http://ppa.launchpad.net/graphics-drivers/ppa/ubuntu xenial/main amd64 libcuda1-384 amd64 384.130-0ubuntu0~gpu16.04.1 [3,703 kB]
Get:40 http://ppa.launchpad.net/graphics-drivers/ppa/ubuntu xenial/main amd64 nvidia-opencl-icd-384 amd64 384.130-0ubuntu0~gpu16.04.1 [3,372 kB]
Fetched 80.3 MB in 8min 12s (163 kB/s)
Extracting templates from packages: 100%
(Reading database ... 267185 files and directories currently installed.)
Removing libcuda1-390 (390.48-0ubuntu0~gpu16.04.3) ...
Removing nvidia-opencl-icd-390 (390.48-0ubuntu0~gpu16.04.3) ...
Removing nvidia-390 (390.48-0ubuntu0~gpu16.04.3) ...
Removing all DKMS Modules
Done.
update-alternatives: using /usr/lib/nvidia-390-prime/ld.so.conf to provide /etc/ld.so.conf.d/x86_64-linux-gnu_GL.conf (x86_64-linux-gnu_gl_conf) in auto mode
update-alternatives: using /usr/lib/nvidia-390-prime/ld.so.conf to provide /etc/ld.so.conf.d/x86_64-linux-gnu_EGL.conf (x86_64-linux-gnu_egl_conf) in auto mode
update-alternatives: using /usr/lib/nvidia-390-prime/alt_ld.so.conf to provide /etc/ld.so.conf.d/i386-linux-gnu_GL.conf (i386-linux-gnu_gl_conf) in auto mode
update-alternatives: using /usr/lib/nvidia-390-prime/alt_ld.so.conf to provide /etc/ld.so.conf.d/i386-linux-gnu_EGL.conf (i386-linux-gnu_egl_conf) in auto mode
update-alternatives: using /usr/lib/x86_64-linux-gnu/mesa/ld.so.conf to provide /etc/ld.so.conf.d/x86_64-linux-gnu_GL.conf (x86_64-linux-gnu_gl_conf) in auto mode
update-alternatives: using /usr/lib/x86_64-linux-gnu/mesa-egl/ld.so.conf to provide /etc/ld.so.conf.d/x86_64-linux-gnu_EGL.conf (x86_64-linux-gnu_egl_conf) in auto mode
INFO:Disable nvidia-390
DEBUG:Parsing /usr/share/ubuntu-drivers-common/quirks/lenovo_thinkpad
DEBUG:Parsing /usr/share/ubuntu-drivers-common/quirks/put_your_quirks_here
DEBUG:Parsing /usr/share/ubuntu-drivers-common/quirks/dell_latitude
update-initramfs: deferring update (trigger activated)
Processing triggers for libc-bin (2.23-0ubuntu10) ...
Processing triggers for man-db (2.7.5-1) ...
Processing triggers for initramfs-tools (0.122ubuntu8.11) ...
update-initramfs: Generating /boot/initrd.img-4.10.0-28-generic
W: Possible missing firmware /lib/firmware/ast_dp501_fw.bin for module ast
Selecting previously unselected package cuda-license-9-0.
(Reading database ... 266598 files and directories currently installed.)
Preparing to unpack .../cuda-license-9-0_9.0.176-1_amd64.deb ...
Unpacking cuda-license-9-0 (9.0.176-1) ...
Selecting previously unselected package cuda-misc-headers-9-0.
Preparing to unpack .../cuda-misc-headers-9-0_9.0.176-1_amd64.deb ...
Unpacking cuda-misc-headers-9-0 (9.0.176-1) ...
Selecting previously unselected package cuda-core-9-0.
Preparing to unpack .../cuda-core-9-0_9.0.176-1_amd64.deb ...
Unpacking cuda-core-9-0 (9.0.176-1) ...
Selecting previously unselected package cuda-cudart-9-0.
Preparing to unpack .../cuda-cudart-9-0_9.0.176-1_amd64.deb ...
Unpacking cuda-cudart-9-0 (9.0.176-1) ...
Selecting previously unselected package cuda-driver-dev-9-0.
Preparing to unpack .../cuda-driver-dev-9-0_9.0.176-1_amd64.deb ...
Unpacking cuda-driver-dev-9-0 (9.0.176-1) ...
Selecting previously unselected package cuda-cudart-dev-9-0.
Preparing to unpack .../cuda-cudart-dev-9-0_9.0.176-1_amd64.deb ...
Unpacking cuda-cudart-dev-9-0 (9.0.176-1) ...
Selecting previously unselected package cuda-command-line-tools-9-0.
Preparing to unpack .../cuda-command-line-tools-9-0_9.0.176-1_amd64.deb ...
Unpacking cuda-command-line-tools-9-0 (9.0.176-1) ...
Selecting previously unselected package cuda-nvrtc-9-0.
Preparing to unpack .../cuda-nvrtc-9-0_9.0.176-1_amd64.deb ...
Unpacking cuda-nvrtc-9-0 (9.0.176-1) ...
Selecting previously unselected package cuda-nvrtc-dev-9-0.
Preparing to unpack .../cuda-nvrtc-dev-9-0_9.0.176-1_amd64.deb ...
Unpacking cuda-nvrtc-dev-9-0 (9.0.176-1) ...
Selecting previously unselected package cuda-cusolver-9-0.
Preparing to unpack .../cuda-cusolver-9-0_9.0.176-1_amd64.deb ...
Unpacking cuda-cusolver-9-0 (9.0.176-1) ...
Selecting previously unselected package cuda-cusolver-dev-9-0.
Preparing to unpack .../cuda-cusolver-dev-9-0_9.0.176-1_amd64.deb ...
Unpacking cuda-cusolver-dev-9-0 (9.0.176-1) ...
Selecting previously unselected package cuda-cublas-9-0.
Preparing to unpack .../cuda-cublas-9-0_9.0.176-1_amd64.deb ...
Unpacking cuda-cublas-9-0 (9.0.176-1) ...
Selecting previously unselected package cuda-cublas-dev-9-0.
Preparing to unpack .../cuda-cublas-dev-9-0_9.0.176-1_amd64.deb ...
Unpacking cuda-cublas-dev-9-0 (9.0.176-1) ...
Selecting previously unselected package cuda-cufft-9-0.
Preparing to unpack .../cuda-cufft-9-0_9.0.176-1_amd64.deb ...
Unpacking cuda-cufft-9-0 (9.0.176-1) ...
Selecting previously unselected package cuda-cufft-dev-9-0.
Preparing to unpack .../cuda-cufft-dev-9-0_9.0.176-1_amd64.deb ...
Unpacking cuda-cufft-dev-9-0 (9.0.176-1) ...
Selecting previously unselected package cuda-curand-9-0.
Preparing to unpack .../cuda-curand-9-0_9.0.176-1_amd64.deb ...
Unpacking cuda-curand-9-0 (9.0.176-1) ...
Selecting previously unselected package cuda-curand-dev-9-0.
Preparing to unpack .../cuda-curand-dev-9-0_9.0.176-1_amd64.deb ...
Unpacking cuda-curand-dev-9-0 (9.0.176-1) ...
Selecting previously unselected package cuda-cusparse-9-0.
Preparing to unpack .../cuda-cusparse-9-0_9.0.176-1_amd64.deb ...
Unpacking cuda-cusparse-9-0 (9.0.176-1) ...
Selecting previously unselected package cuda-cusparse-dev-9-0.
Preparing to unpack .../cuda-cusparse-dev-9-0_9.0.176-1_amd64.deb ...
Unpacking cuda-cusparse-dev-9-0 (9.0.176-1) ...
Selecting previously unselected package cuda-npp-9-0.
Preparing to unpack .../cuda-npp-9-0_9.0.176-1_amd64.deb ...
Unpacking cuda-npp-9-0 (9.0.176-1) ...
Selecting previously unselected package cuda-npp-dev-9-0.
Preparing to unpack .../cuda-npp-dev-9-0_9.0.176-1_amd64.deb ...
Unpacking cuda-npp-dev-9-0 (9.0.176-1) ...
Selecting previously unselected package cuda-nvgraph-9-0.
Preparing to unpack .../cuda-nvgraph-9-0_9.0.176-1_amd64.deb ...
Unpacking cuda-nvgraph-9-0 (9.0.176-1) ...
Selecting previously unselected package cuda-nvgraph-dev-9-0.
Preparing to unpack .../cuda-nvgraph-dev-9-0_9.0.176-1_amd64.deb ...
Unpacking cuda-nvgraph-dev-9-0 (9.0.176-1) ...
Selecting previously unselected package cuda-samples-9-0.
Preparing to unpack .../cuda-samples-9-0_9.0.176-1_amd64.deb ...
Unpacking cuda-samples-9-0 (9.0.176-1) ...
Selecting previously unselected package cuda-documentation-9-0.
Preparing to unpack .../cuda-documentation-9-0_9.0.176-1_amd64.deb ...
Unpacking cuda-documentation-9-0 (9.0.176-1) ...
Selecting previously unselected package cuda-libraries-dev-9-0.
Preparing to unpack .../cuda-libraries-dev-9-0_9.0.176-1_amd64.deb ...
Unpacking cuda-libraries-dev-9-0 (9.0.176-1) ...
Selecting previously unselected package cuda-nvml-dev-9-0.
Preparing to unpack .../cuda-nvml-dev-9-0_9.0.176-1_amd64.deb ...
Unpacking cuda-nvml-dev-9-0 (9.0.176-1) ...
Selecting previously unselected package cuda-visual-tools-9-0.
Preparing to unpack .../cuda-visual-tools-9-0_9.0.176-1_amd64.deb ...
Unpacking cuda-visual-tools-9-0 (9.0.176-1) ...
Selecting previously unselected package cuda-toolkit-9-0.
Preparing to unpack .../cuda-toolkit-9-0_9.0.176-1_amd64.deb ...
Unpacking cuda-toolkit-9-0 (9.0.176-1) ...
Selecting previously unselected package nvidia-384.
Preparing to unpack .../nvidia-384_384.130-0ubuntu0~gpu16.04.1_amd64.deb ...
Unpacking nvidia-384 (384.130-0ubuntu0~gpu16.04.1) ...
Selecting previously unselected package nvidia-384-dev.
Preparing to unpack .../nvidia-384-dev_384.130-0ubuntu0~gpu16.04.1_amd64.deb ...
Unpacking nvidia-384-dev (384.130-0ubuntu0~gpu16.04.1) ...
Selecting previously unselected package libcuda1-384.
Preparing to unpack .../libcuda1-384_384.130-0ubuntu0~gpu16.04.1_amd64.deb ...
Unpacking libcuda1-384 (384.130-0ubuntu0~gpu16.04.1) ...
Selecting previously unselected package nvidia-modprobe.
Preparing to unpack .../nvidia-modprobe_384.81-0ubuntu1_amd64.deb ...
Unpacking nvidia-modprobe (384.81-0ubuntu1) ...
Selecting previously unselected package nvidia-opencl-icd-384.
Preparing to unpack .../nvidia-opencl-icd-384_384.130-0ubuntu0~gpu16.04.1_amd64.deb ...
Unpacking nvidia-opencl-icd-384 (384.130-0ubuntu0~gpu16.04.1) ...
Selecting previously unselected package cuda-drivers.
Preparing to unpack .../cuda-drivers_384.81-1_amd64.deb ...
Unpacking cuda-drivers (384.81-1) ...
Selecting previously unselected package cuda-libraries-9-0.
Preparing to unpack .../cuda-libraries-9-0_9.0.176-1_amd64.deb ...
Unpacking cuda-libraries-9-0 (9.0.176-1) ...
Selecting previously unselected package cuda-runtime-9-0.
Preparing to unpack .../cuda-runtime-9-0_9.0.176-1_amd64.deb ...
Unpacking cuda-runtime-9-0 (9.0.176-1) ...
Selecting previously unselected package cuda-demo-suite-9-0.
Preparing to unpack .../cuda-demo-suite-9-0_9.0.176-1_amd64.deb ...
Unpacking cuda-demo-suite-9-0 (9.0.176-1) ...
Selecting previously unselected package cuda-9-0.
Preparing to unpack ..././cuda-9-0_9.0.176-1_amd64.deb ...
Unpacking cuda-9-0 (9.0.176-1) ...
Selecting previously unselected package cuda.
Preparing to unpack ..././cuda_9.0.176-1_amd64.deb ...
Unpacking cuda (9.0.176-1) ...
Processing triggers for libc-bin (2.23-0ubuntu10) ...
Processing triggers for man-db (2.7.5-1) ...
Processing triggers for ureadahead (0.100.0-19) ...
Setting up cuda-license-9-0 (9.0.176-1) ...
*** LICENSE AGREEMENT ***
By using this software you agree to fully comply with the terms and
conditions of the EULA (End User License Agreement). The EULA is located
at /usr/local/cuda-9.0/doc/EULA.txt. The EULA can also be found at
http://docs.nvidia.com/cuda/eula/index.html. If you do not agree to the
terms and conditions of the EULA, do not use the software.

Setting up cuda-misc-headers-9-0 (9.0.176-1) ...
Setting up cuda-core-9-0 (9.0.176-1) ...
Setting up cuda-cudart-9-0 (9.0.176-1) ...
Setting up cuda-driver-dev-9-0 (9.0.176-1) ...
Setting up cuda-cudart-dev-9-0 (9.0.176-1) ...
Setting up cuda-command-line-tools-9-0 (9.0.176-1) ...
Setting up cuda-nvrtc-9-0 (9.0.176-1) ...
Setting up cuda-nvrtc-dev-9-0 (9.0.176-1) ...
Setting up cuda-cusolver-9-0 (9.0.176-1) ...
Setting up cuda-cusolver-dev-9-0 (9.0.176-1) ...
Setting up cuda-cublas-9-0 (9.0.176-1) ...
Setting up cuda-cublas-dev-9-0 (9.0.176-1) ...
Setting up cuda-cufft-9-0 (9.0.176-1) ...
Setting up cuda-cufft-dev-9-0 (9.0.176-1) ...
Setting up cuda-curand-9-0 (9.0.176-1) ...
Setting up cuda-curand-dev-9-0 (9.0.176-1) ...
Setting up cuda-cusparse-9-0 (9.0.176-1) ...
Setting up cuda-cusparse-dev-9-0 (9.0.176-1) ...
Setting up cuda-npp-9-0 (9.0.176-1) ...
Setting up cuda-npp-dev-9-0 (9.0.176-1) ...
Setting up cuda-nvgraph-9-0 (9.0.176-1) ...
Setting up cuda-nvgraph-dev-9-0 (9.0.176-1) ...
Setting up cuda-samples-9-0 (9.0.176-1) ...
Setting up cuda-documentation-9-0 (9.0.176-1) ...
Setting up cuda-libraries-dev-9-0 (9.0.176-1) ...
Setting up cuda-nvml-dev-9-0 (9.0.176-1) ...
Setting up cuda-visual-tools-9-0 (9.0.176-1) ...
Setting up cuda-toolkit-9-0 (9.0.176-1) ...
Setting up nvidia-384 (384.130-0ubuntu0~gpu16.04.1) ...
update-alternatives: using /usr/lib/nvidia-384/ld.so.conf to provide /etc/ld.so.conf.d/x86_64-linux-gnu_GL.conf (x86_64-linux-gnu_gl_conf) in auto mode
update-alternatives: using /usr/lib/nvidia-384/ld.so.conf to provide /etc/ld.so.conf.d/x86_64-linux-gnu_EGL.conf (x86_64-linux-gnu_egl_conf) in auto mode
update-alternatives: using /usr/lib/nvidia-384/alt_ld.so.conf to provide /etc/ld.so.conf.d/i386-linux-gnu_GL.conf (i386-linux-gnu_gl_conf) in auto mode
update-alternatives: using /usr/lib/nvidia-384/alt_ld.so.conf to provide /etc/ld.so.conf.d/i386-linux-gnu_EGL.conf (i386-linux-gnu_egl_conf) in auto mode
update-alternatives: using /usr/share/nvidia-384/glamor.conf to provide /usr/share/X11/xorg.conf.d/glamoregl.conf (glamor_conf) in auto mode
update-initramfs: deferring update (trigger activated)
INFO:Enable nvidia-384
DEBUG:Parsing /usr/share/ubuntu-drivers-common/quirks/lenovo_thinkpad
DEBUG:Parsing /usr/share/ubuntu-drivers-common/quirks/put_your_quirks_here
DEBUG:Parsing /usr/share/ubuntu-drivers-common/quirks/dell_latitude
Adding system user `nvidia-persistenced' (UID 122) ...
Adding new group `nvidia-persistenced' (GID 129) ...
Adding new user `nvidia-persistenced' (UID 122) with group `nvidia-persistenced' ...
Not creating home directory `/'.
Loading new nvidia-384-384.130 DKMS files...
First Installation: checking all kernels...
Building only for 4.10.0-28-generic
Building for architecture x86_64
Module build for the currently running kernel was skipped since the
kernel source for this kernel does not seem to be installed.
Setting up nvidia-384-dev (384.130-0ubuntu0~gpu16.04.1) ...
Setting up libcuda1-384 (384.130-0ubuntu0~gpu16.04.1) ...
Setting up nvidia-modprobe (384.81-0ubuntu1) ...
Setting up nvidia-opencl-icd-384 (384.130-0ubuntu0~gpu16.04.1) ...
Setting up cuda-drivers (384.81-1) ...
Setting up cuda-libraries-9-0 (9.0.176-1) ...
Setting up cuda-runtime-9-0 (9.0.176-1) ...
Setting up cuda-demo-suite-9-0 (9.0.176-1) ...
Setting up cuda-9-0 (9.0.176-1) ...
Setting up cuda (9.0.176-1) ...
Processing triggers for libc-bin (2.23-0ubuntu10) ...
Processing triggers for initramfs-tools (0.122ubuntu8.11) ...
update-initramfs: Generating /boot/initrd.img-4.10.0-28-generic
W: Possible missing firmware /lib/firmware/ast_dp501_fw.bin for module ast
Processing triggers for shim-signed (1.33.1~16.04.1+13-0ubuntu2) ...
Secure Boot not enabled on this system.
aaa@qq.com:~/Downloads$

    该工作站之前配过了cuda的环境,这里就不再一一安装,直接测试cuda是否能用:

aaa@qq.com:~/Downloads$ nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2017 NVIDIA Corporation
Built on Fri_Sep__1_21:08:03_CDT_2017
Cuda compilation tools, release 9.0, V9.0.176