基于Ubuntu14.04搭建caffe训练环境

各种教学视频或文档资料 +QQ:635992897

一、基础环境配置
0、apt-get update
1、sshd安装
    sudo apt-get install openssh-server
2、Vi重装
   apt-get install vim
3、Samba 安装及配置
     3.1 sudo apt-get install samba samba-common
     3.2 配置如下:
     # Cap the size of the individual log files (in KiB).
      max log size = 1000
      这些下面加
     security = user
    
     配置文件最下面加
     [myshare]
     comment = this is Linux share directory
     path = /home/share
  #   public = yes
    browseable = yes
     writable = yes
     user = system,ubuntu
     create mask = 0755
     force create mode = 0755
     directory mask = 0755
     force directory mode = 0755
     available = yes
     
     3.3.添加smb用户
       sudo smbpasswd -a smbuser
      这里一定要保证在linux系统中也有smbuser用户,名称可以自己定
     3.4 错误处理
          ubuntu14.04中文版装好samba后,报各种错,查看/var/log/samba日志,发现也是报各种错,最后处理发现linux 下使用smbclient 访问正常,Windows下访问报如下:
          "无法访问。您可能没有权限使用网络资源,请与这台服务器的管理员联系以查明您是否有访问权限。指定的网络名不再可用。"
         日志中有如下错误:
        
         [2016/12/21 08:43:18.450576,  0] ../source3/lib/dumpcore.c:303(dump_core)
       dumping core in /var/log/samba/cores/smbd
  [2016/12/21 08:43:18.614643,  0] ../source3/lib/popt_common.c:68(popt_s3_talloc_log_fn)
    talloc: access after free error - first free may be at ../source3/smbd/open.c:3715
  [2016/12/21 08:43:18.614690,  0] ../source3/lib/popt_common.c:68(popt_s3_talloc_log_fn)
    Bad talloc magic value - access after free
  [2016/12/21 08:43:18.614710,  0] ../source3/lib/util.c:789(smb_panic_s3)
    PANIC (pid 5348): Bad talloc magic value - access after free
  [2016/12/21 08:43:18.615376,  0] ../source3/lib/util.c:900(log_stack_trace)
    BACKTRACE: 26 stack frames:
     #0 /usr/lib/x86_64-linux-gnu/samba/libsmbregistry.so.0(log_stack_trace+0x1a) [0x7f24d91e914a]
     
     处理方式:
      sudo apt-get install libtalloc2 升级 libtalloc2,参考:http://blog.csdn.net/merlinholland/article/details/52822501
4、sudo自动切换
 visudo
 插入如下信息:
  ## Allows people in group wheel to run all commands
  # %wheel        ALL=(ALL)       ALL
  
  ## Same thing without a password
  %wheel  ALL=(ALL)       NOPASSWD: ALL
  system ALL=(ALL)       NOPASSWD: ALL
  ubuntu ALL=(ALL)       NOPASSWD: ALL
         其中 system ubuntu 是你想支持用户
5、安装nvidia 驱动,这里是安装Tesla k20c的驱动,也支持k40c 、k80,具体如下:
      Tesla K80, Tesla K40c, Tesla K40m, Tesla K40s, Tesla K40st, Tesla K40t, Tesla K20Xm, Tesla K20m, Tesla K20s, Tesla K20c, Tesla K10
5.1 安装 bumblebee
      sudo add-apt-repository ppa:bumblebee/stable
      sudo apt-get update
      sudo apt-get install bumblebee bumblebee-nvidia
     
5.2 安装nvidia驱动
      参考:http://blog.csdn.net/TriLoo/article/details/52678033?locationNum=14
     备用: http://blog.163.com/zhao_en_peng/blog/static/12740422420131202110539/
     
      5.2.1.查看电脑的显卡信息以及正在使用的显卡驱动
        查看电脑显卡信息命令:lspci | grep VGA
        lspci会显示所有的PCI接口设备,然后从中提取处显示相关的设备(VGA)。
        执行命令会得到类似下面的信息:
  01:00.0 VGA compatible controller: NVIDIA Corporation GM107 [GeForce GTX 745] (rev a2)
       从上面的信息可以看出:显卡型号为GTX745。显卡型号会在后面下载显卡驱动时用到。
      得到显卡型号后,可以利用下面的命令查看关于显卡的更详细信息:
      lspci -v -s 01:00.01
     -v : 显示详细信息
 -s : 后面接PCI设备的ID
 执行命令会得到类似下面的信息:
 01:00.0 VGA compatible controller: NVIDIA Corporation GM107 [GeForce GTX 745] (rev a2) (prog-if 00 [VGA controller])
  Subsystem: NVIDIA Corporation Device 1065
  Flags: bus master, fast devsel, latency 0, IRQ 34
  Memory at f6000000 (32-bit, non-prefetchable) [size=16M]
  Memory at e0000000 (64-bit, prefetchable) [size=256M]
  Memory at f0000000 (64-bit, prefetchable) [size=32M]
  I/O ports at e000 [size=128]
  [virtual] Expansion ROM at f7000000 [disabled] [size=512K]
  Capabilities:
  Kernel driver in use: nvidias
 
 其中在最后一行显示正在使用的驱动是nvidias。这是安装Nvidia显卡后的显示,最开始会显示nouveau。
  在倒数第二行显示access denied,是因为权限问题,可以sudo解决。
 
 好了现在我们知道了显卡型号以及显卡驱动信息了下一步是去Nvidia官网下载相应的显卡驱动程序。
 1.下载驱动
 Nvidia驱动下载链接:Nvidia。
 http://cn.download.nvidia.com/XFree86/Linux-x86_64/346.96/NVIDIA-Linux-x86_64-346.96.run
 #http://cn.download.nvidia.com/Ubuntu/346.96/nvidia-driver-repo-ubuntu1404_7.0-346.96_ppc64el.deb
 在打开的界面中(界面如下图),建议选用手动根据自己的系统、显卡型号等选择相关的驱动。
   
    5.2.2.禁止nouveau驱动
  通过网上的相关信息,如果之前显卡驱动是用的nouveau,那么在安装自己下载的驱动的时候会显示错误。
  所以在安装驱动之前,需要先在/etc/modprobe.d/blacklist.conf文件中加入下面内容:
     blacklist nouveau
     然后重新启动。

      sudo reboot
 5.2.3.安装显卡
  重启后,在登陆界面时同时按下:Ctrl + Alt + F1~F6进入字符界面。
  也可以在登陆界面登陆后,在终端输入init 3来改变run level.
 需要说明的是,重启后,会发现字体变大,这属于正常显现。
  登陆tt1终端,然后关闭Ubuntu的Unity:
 sudo service lightdm stop
 其中lightdm根据自己使用的桌面做相应的调整:
 [KDM(KDE),GDM(GNOME)
 然后进入之前下载的驱动文件所在的目录,运行下载的脚本文件即可:
    sudo sh NVIDIA-Linux-x86_64-346.96.run
 #sudo dpkg -i  nvidia-driver-repo-ubuntu1404_7.0-346.96_ppc64el.deb 错误


    后面根据程序的提示操作即可。
 5.2.4.重启
  安装完成后,重启即可。
  sudo service lightdm start
  问题处理:
   (1) 安装完成后重启可能会出现循环登录的情况,解决方法是重启前先按照下面教程安装一个管理软件:
     http://blog.csdn.net/triloo/article/details/52767412
     见5.1安装 bumblebee
     (2)错误信息:
          软件包的体系架构(ppc64el)与本机系统的架构(amd64)不符
          在处理时有错误发生:
   nvidia-driver-repo-ubuntu1404_7.0-346.96_ppc64el.deb
   下载安装包错误,重新下载适合你机器的安装包即可

      安装检查工具
      sudo apt-get install mesa-utils
6、安装CUDA7.0
 下载CUDA7.0
 6.1安装 cuda
 6.1.1安装依赖库
  sudo apt-get install freeglut3-dev build-essential libx11-dev libxmu-dev libxi-dev libgl1-mesa-glx libglu1-mesa libglu1-mesa-dev
    6.1.2安装CUDA7.0  参考:http://blog.csdn.net/a350203223/article/details/50262535
  (1) sudo dpkg -i cuda-repo-ubuntu1404-7-0-local_7.0-28_amd64.deb
    Selecting previously unselected package cuda-repo-ubuntu1404-7-0-local.
   (正在读取数据库 ... 系统当前共安装有 171979 个文件和目录。)
   Preparing to unpack cuda-repo-ubuntu1404-7-0-local_7.0-28_amd64.deb ...
   Unpacking cuda-repo-ubuntu1404-7-0-local (7.0-28) ...
   正在设置 cuda-repo-ubuntu1404-7-0-local (7.0-28) ...
   OK
     (1.5) sudo apt-get update
     (2)sudo apt-get install cuda
    正在读取软件包列表... 完成
    正在分析软件包的依赖关系树      
    正在读取状态信息... 完成      
    下列软件包是自动安装的并且现在不需要了:
      libcublas5.5 libcudart5.5 libcufft5.5 libcufftw5.5 libcuinj64-5.5
      libcurand5.5 libcusparse5.5 libnppc5.5 libnppi5.5 libnpps5.5 libnvtoolsext1
      libnvvm2 libthrust-dev libvdpau-dev nvidia-cuda-dev nvidia-cuda-doc
      nvidia-cuda-gdb nvidia-profiler nvidia-visual-profiler opencl-headers
    Use 'apt-get autoremove' to remove them.
    将会安装下列额外的软件包:
      cuda-7-0 cuda-command-line-tools-7-0 cuda-core-7-0 cuda-cublas-7-0
      cuda-cublas-dev-7-0 cuda-cudart-7-0 cuda-cudart-dev-7-0 cuda-cufft-7-0
      cuda-cufft-dev-7-0 cuda-curand-7-0 cuda-curand-dev-7-0 cuda-cusolver-7-0
      cuda-cusolver-dev-7-0 cuda-cusparse-7-0 cuda-cusparse-dev-7-0
      cuda-documentation-7-0 cuda-driver-dev-7-0 cuda-drivers cuda-license-7-0
      cuda-misc-headers-7-0 cuda-npp-7-0 cuda-npp-dev-7-0 cuda-nvrtc-7-0
      cuda-nvrtc-dev-7-0 cuda-runtime-7-0 cuda-samples-7-0 cuda-toolkit-7-0
      cuda-visual-tools-7-0 libcuda1-346 libcuda1-352 libcuda1-367 nvidia-346
      nvidia-346-dev nvidia-346-uvm nvidia-352 nvidia-352-dev nvidia-367
      nvidia-367-dev nvidia-modprobe nvidia-opencl-icd-346 nvidia-opencl-icd-352
      nvidia-opencl-icd-367 nvidia-settings ocl-icd-libopencl1
    下列软件包将被【卸载】:
      libcuda1-340 nvidia-340 nvidia-340-uvm nvidia-cuda-toolkit
      nvidia-libopencl1-331 nvidia-libopencl1-340 nvidia-opencl-dev
      nvidia-opencl-icd-340
    下列【新】软件包将被安装:
      cuda cuda-7-0 cuda-command-line-tools-7-0 cuda-core-7-0 cuda-cublas-7-0
      cuda-cublas-dev-7-0 cuda-cudart-7-0 cuda-cudart-dev-7-0 cuda-cufft-7-0
      cuda-cufft-dev-7-0 cuda-curand-7-0 cuda-curand-dev-7-0 cuda-cusolver-7-0
      cuda-cusolver-dev-7-0 cuda-cusparse-7-0 cuda-cusparse-dev-7-0
      cuda-documentation-7-0 cuda-driver-dev-7-0 cuda-drivers cuda-license-7-0
      cuda-misc-headers-7-0 cuda-npp-7-0 cuda-npp-dev-7-0 cuda-nvrtc-7-0
      cuda-nvrtc-dev-7-0 cuda-runtime-7-0 cuda-samples-7-0 cuda-toolkit-7-0
      cuda-visual-tools-7-0 libcuda1-346 libcuda1-352 libcuda1-367 nvidia-346
      nvidia-346-dev nvidia-346-uvm nvidia-352 nvidia-352-dev nvidia-367
      nvidia-367-dev nvidia-modprobe nvidia-opencl-icd-346 nvidia-opencl-icd-352
      nvidia-opencl-icd-367 ocl-icd-libopencl1
    下列软件包将被升级:
      nvidia-settings
    升级了 1 个软件包,新安装了 44 个软件包,要卸载 8 个软件包,有 590 个软件包未被升级。
    需要下载 75.5 MB/1,042 MB 的软件包。
    解压缩后会消耗掉 1,556 MB 的额外空间。
    您希望继续执行吗? [Y/n] y
    获取:1 http://cn.archive.ubuntu.com/ubuntu/ trusty-updates/restricted nvidia-352 amd64 367.57-0ubuntu0.14.04.1 [4,802 B]
    获取:2 http://cn.archive.ubuntu.com/ubuntu/ trusty-updates/restricted nvidia-346 amd64 352.63-0ubuntu0.14.04.1 [4,802 B]
    获取:3 http://cn.archive.ubuntu.com/ubuntu/ trusty-updates/restricted nvidia-367 amd64 367.57-0ubuntu0.14.04.1 [69.8 MB]
    获取:4 http://cn.archive.ubuntu.com/ubuntu/ trusty-updates/restricted libcuda1-367 amd64 367.57-0ubuntu0.14.04.1 [2,708 kB]
    获取:5 http://cn.archive.ubuntu.com/ubuntu/ trusty-updates/restricted nvidia-346-uvm amd64 346.96-0ubuntu0.0.1 [4,762 B]
    获取:6 http://cn.archive.ubuntu.com/ubuntu/ trusty-updates/restricted nvidia-367-dev amd64 367.57-0ubuntu0.14.04.1 [80.8 kB]
    获取:7 http://cn.archive.ubuntu.com/ubuntu/ trusty-updates/restricted nvidia-352-dev amd64 367.57-0ubuntu0.14.04.1 [4,806 B]
    获取:8 http://cn.archive.ubuntu.com/ubuntu/ trusty-updates/restricted nvidia-346-dev amd64 352.63-0ubuntu0.14.04.1 [4,812 B]
    获取:9 http://cn.archive.ubuntu.com/ubuntu/ trusty-updates/restricted libcuda1-352 amd64 367.57-0ubuntu0.14.04.1 [4,814 B]
    获取:10 http://cn.archive.ubuntu.com/ubuntu/ trusty-updates/restricted libcuda1-346 amd64 352.63-0ubuntu0.14.04.1 [4,810 B]
    获取:11 http://cn.archive.ubuntu.com/ubuntu/ trusty-updates/restricted nvidia-opencl-icd-367 amd64 367.57-0ubuntu0.14.04.1 [2,901 kB]
    获取:12 http://cn.archive.ubuntu.com/ubuntu/ trusty-updates/restricted nvidia-opencl-icd-352 amd64 367.57-0ubuntu0.14.04.1 [4,818 B]
    获取:13 http://cn.archive.ubuntu.com/ubuntu/ trusty-updates/restricted nvidia-opencl-icd-346 amd64 352.63-0ubuntu0.14.04.1 [4,822 B]
    下载 75.5 MB,耗时 13分 13秒 (95.2 kB/s)                                      
    正在从软件包中解出模板:100%
    Selecting previously unselected package nvidia-352.
    (正在读取数据库 ... 系统当前共安装有 179276 个文件和目录。)
    Preparing to unpack .../nvidia-352_367.57-0ubuntu0.14.04.1_amd64.deb ...
    Unpacking nvidia-352 (367.57-0ubuntu0.14.04.1) ...
    Selecting previously unselected package nvidia-346.
    Preparing to unpack .../nvidia-346_352.63-0ubuntu0.14.04.1_amd64.deb ...
    Unpacking nvidia-346 (352.63-0ubuntu0.14.04.1) ...
    (正在读取数据库 ... 系统当前共安装有 179281 个文件和目录。)
    Removing nvidia-opencl-icd-340 (340.98-0ubuntu0.14.04.1) ...
    Removing nvidia-cuda-toolkit (5.5.22-3ubuntu1) ...
    Removing nvidia-opencl-dev:amd64 (5.5.22-3ubuntu1) ...
    Removing nvidia-libopencl1-331 (340.98-0ubuntu0.14.04.1) ...
    Removing nvidia-libopencl1-340 (340.98-0ubuntu0.14.04.1) ...
    Removing nvidia-340-uvm (340.98-0ubuntu0.14.04.1) ...
    dpkg: nvidia-340: dependency problems, but removing anyway as you requested:
     bumblebee-nvidia 依赖于 nvidia-driver | nvidia-glx | nvidia-kernel-dkms | nvidia-kernel-amd64 | nvidia-kernel-686-pae | nvidia-kernel-486 | nvidia | nvidia-current | nvidia-current-updates | nvidia-driver-binary | nvidia-304 | nvidia-304-updates | nvidia-experimental-304 | nvidia-310 | nvidia-310-updates | nvidia-experimental-310 | nvidia-313 | nvidia-313-updates | nvidia-experimental-313 | nvidia-319 | nvidia-319-updates | nvidia-experimental-319 | nvidia-325 | nvidia-325-updates | nvidia-experimental-325 | nvidia-331 | nvidia-331-updates | nvidia-experimental-331 | nvidia-334 | nvidia-334-updates | nvidia-experimental-334 | nvidia-337 | nvidia-337-updates | nvidia-experimental-337 | nvidia-340 | nvidia-340-updates | nvidia-experimental-340 | nvidia-343 | nvidia-343-updates | nvidia-experimental-343 | nvidia-346 | nvidia-346-updates | nvidia-experimental-346 | nvidia-349 | nvidia-349-updates | nvidia-experimental-349 | nvidia-352 | n
    Removing nvidia-340 (340.98-0ubuntu0.14.04.1) ...
    Stopping nvidia-persistenced
    nvidia-persistenced:没有发现操作
    Done.
    Removing all DKMS Modules
    Done.
    INFO:Disable nvidia-340
    DEBUG:Parsing /usr/share/ubuntu-drivers-common/quirks/put_your_quirks_here
    DEBUG:Parsing /usr/share/ubuntu-drivers-common/quirks/dell_latitude
    DEBUG:Parsing /usr/share/ubuntu-drivers-common/quirks/lenovo_thinkpad
    update-initramfs: deferring update (trigger activated)
    Processing triggers for libc-bin (2.19-0ubuntu6) ...
    Processing triggers for man-db (2.6.7.1-1) ...
    Processing triggers for initramfs-tools (0.103ubuntu4.2) ...
    update-initramfs: Generating /boot/initrd.img-3.13.0-32-generic
    Selecting previously unselected package nvidia-367.
    (正在读取数据库 ... 系统当前共安装有 178942 个文件和目录。)
    Preparing to unpack .../nvidia-367_367.57-0ubuntu0.14.04.1_amd64.deb ...
    Unpacking nvidia-367 (367.57-0ubuntu0.14.04.1) ...
    Processing triggers for ureadahead (0.100.0-16) ...
    Processing triggers for man-db (2.6.7.1-1) ...
    dpkg: libcuda1-340: dependency problems, but removing anyway as you requested:
     libcuinj64-5.5:amd64 依赖于 libcuda-5.5-1;然而:
      未安装软件包 libcuda-5.5-1。
      提供了 libcuda-5.5-1 的软件包 libcuda1-340 即将被删除。
     nvidia-profiler 依赖于 libcuda-5.5-1;然而:
      未安装软件包 libcuda-5.5-1。
      提供了 libcuda-5.5-1 的软件包 libcuda1-340 即将被删除。
    
    (正在读取数据库 ... 系统当前共安装有 179508 个文件和目录。)
    Removing libcuda1-340 (340.98-0ubuntu0.14.04.1) ...
    Processing triggers for libc-bin (2.19-0ubuntu6) ...
    Selecting previously unselected package libcuda1-367.
    (正在读取数据库 ... 系统当前共安装有 179500 个文件和目录。)
    Preparing to unpack .../libcuda1-367_367.57-0ubuntu0.14.04.1_amd64.deb ...
    Unpacking libcuda1-367 (367.57-0ubuntu0.14.04.1) ...
    Selecting previously unselected package ocl-icd-libopencl1:amd64.
    Preparing to unpack .../ocl-icd-libopencl1_2.1.3-4_amd64.deb ...
    Unpacking ocl-icd-libopencl1:amd64 (2.1.3-4) ...
    Selecting previously unselected package cuda-license-7-0.
    Preparing to unpack .../cuda-license-7-0_7.0-28_amd64.deb ...
    Unpacking cuda-license-7-0 (7.0-28) ...
    Selecting previously unselected package cuda-misc-headers-7-0.
    Preparing to unpack .../cuda-misc-headers-7-0_7.0-28_amd64.deb ...
    Unpacking cuda-misc-headers-7-0 (7.0-28) ...
    Selecting previously unselected package cuda-core-7-0.
    Preparing to unpack .../cuda-core-7-0_7.0-28_amd64.deb ...
    Unpacking cuda-core-7-0 (7.0-28) ...
    Selecting previously unselected package cuda-cudart-7-0.
    Preparing to unpack .../cuda-cudart-7-0_7.0-28_amd64.deb ...
    Unpacking cuda-cudart-7-0 (7.0-28) ...
    Selecting previously unselected package cuda-driver-dev-7-0.
    Preparing to unpack .../cuda-driver-dev-7-0_7.0-28_amd64.deb ...
    Unpacking cuda-driver-dev-7-0 (7.0-28) ...
    Selecting previously unselected package cuda-cudart-dev-7-0.
    Preparing to unpack .../cuda-cudart-dev-7-0_7.0-28_amd64.deb ...
    Unpacking cuda-cudart-dev-7-0 (7.0-28) ...
    Selecting previously unselected package cuda-command-line-tools-7-0.
    Preparing to unpack .../cuda-command-line-tools-7-0_7.0-28_amd64.deb ...
    Unpacking cuda-command-line-tools-7-0 (7.0-28) ...
    Selecting previously unselected package cuda-nvrtc-7-0.
    Preparing to unpack .../cuda-nvrtc-7-0_7.0-28_amd64.deb ...
    Unpacking cuda-nvrtc-7-0 (7.0-28) ...
    Selecting previously unselected package cuda-nvrtc-dev-7-0.
    Preparing to unpack .../cuda-nvrtc-dev-7-0_7.0-28_amd64.deb ...
    Unpacking cuda-nvrtc-dev-7-0 (7.0-28) ...
    Selecting previously unselected package cuda-cusolver-7-0.
    Preparing to unpack .../cuda-cusolver-7-0_7.0-28_amd64.deb ...
    Unpacking cuda-cusolver-7-0 (7.0-28) ...
    Selecting previously unselected package cuda-cusolver-dev-7-0.
    Preparing to unpack .../cuda-cusolver-dev-7-0_7.0-28_amd64.deb ...
    Unpacking cuda-cusolver-dev-7-0 (7.0-28) ...
    Selecting previously unselected package cuda-cublas-7-0.
    Preparing to unpack .../cuda-cublas-7-0_7.0-28_amd64.deb ...
    Unpacking cuda-cublas-7-0 (7.0-28) ...
    Selecting previously unselected package cuda-cublas-dev-7-0.
    Preparing to unpack .../cuda-cublas-dev-7-0_7.0-28_amd64.deb ...
    Unpacking cuda-cublas-dev-7-0 (7.0-28) ...
    Selecting previously unselected package cuda-cufft-7-0.
    Preparing to unpack .../cuda-cufft-7-0_7.0-28_amd64.deb ...
    Unpacking cuda-cufft-7-0 (7.0-28) ...
    Selecting previously unselected package cuda-cufft-dev-7-0.
    Preparing to unpack .../cuda-cufft-dev-7-0_7.0-28_amd64.deb ...
    Unpacking cuda-cufft-dev-7-0 (7.0-28) ...
    Selecting previously unselected package cuda-curand-7-0.
    Preparing to unpack .../cuda-curand-7-0_7.0-28_amd64.deb ...
    Unpacking cuda-curand-7-0 (7.0-28) ...
    Selecting previously unselected package cuda-curand-dev-7-0.
    Preparing to unpack .../cuda-curand-dev-7-0_7.0-28_amd64.deb ...
    Unpacking cuda-curand-dev-7-0 (7.0-28) ...
    Selecting previously unselected package cuda-cusparse-7-0.
    Preparing to unpack .../cuda-cusparse-7-0_7.0-28_amd64.deb ...
    Unpacking cuda-cusparse-7-0 (7.0-28) ...
    Selecting previously unselected package cuda-cusparse-dev-7-0.
    Preparing to unpack .../cuda-cusparse-dev-7-0_7.0-28_amd64.deb ...
    Unpacking cuda-cusparse-dev-7-0 (7.0-28) ...
    Selecting previously unselected package cuda-npp-7-0.
    Preparing to unpack .../cuda-npp-7-0_7.0-28_amd64.deb ...
    Unpacking cuda-npp-7-0 (7.0-28) ...
    Selecting previously unselected package cuda-npp-dev-7-0.
    Preparing to unpack .../cuda-npp-dev-7-0_7.0-28_amd64.deb ...
    Unpacking cuda-npp-dev-7-0 (7.0-28) ...
    Selecting previously unselected package cuda-samples-7-0.
    Preparing to unpack .../cuda-samples-7-0_7.0-28_amd64.deb ...
    Unpacking cuda-samples-7-0 (7.0-28) ...
    Selecting previously unselected package cuda-documentation-7-0.
    Preparing to unpack .../cuda-documentation-7-0_7.0-28_amd64.deb ...
    Unpacking cuda-documentation-7-0 (7.0-28) ...
    Selecting previously unselected package cuda-visual-tools-7-0.
    Preparing to unpack .../cuda-visual-tools-7-0_7.0-28_amd64.deb ...
    Unpacking cuda-visual-tools-7-0 (7.0-28) ...
    Selecting previously unselected package cuda-toolkit-7-0.
    Preparing to unpack .../cuda-toolkit-7-0_7.0-28_amd64.deb ...
    Unpacking cuda-toolkit-7-0 (7.0-28) ...
    Selecting previously unselected package nvidia-346-uvm.
    Preparing to unpack .../nvidia-346-uvm_346.96-0ubuntu0.0.1_amd64.deb ...
    Unpacking nvidia-346-uvm (346.96-0ubuntu0.0.1) ...
    Selecting previously unselected package nvidia-367-dev.
    Preparing to unpack .../nvidia-367-dev_367.57-0ubuntu0.14.04.1_amd64.deb ...
    Unpacking nvidia-367-dev (367.57-0ubuntu0.14.04.1) ...
    Selecting previously unselected package nvidia-352-dev.
    Preparing to unpack .../nvidia-352-dev_367.57-0ubuntu0.14.04.1_amd64.deb ...
    Unpacking nvidia-352-dev (367.57-0ubuntu0.14.04.1) ...
    Selecting previously unselected package nvidia-346-dev.
    Preparing to unpack .../nvidia-346-dev_352.63-0ubuntu0.14.04.1_amd64.deb ...
    Unpacking nvidia-346-dev (352.63-0ubuntu0.14.04.1) ...
    Selecting previously unselected package nvidia-modprobe.
    Preparing to unpack .../nvidia-modprobe_346.46-0ubuntu1_amd64.deb ...
    Unpacking nvidia-modprobe (346.46-0ubuntu1) ...
    Preparing to unpack .../nvidia-settings_346.46-0ubuntu1_amd64.deb ...
    Unpacking nvidia-settings (346.46-0ubuntu1) over (331.20-0ubuntu8) ...
    Selecting previously unselected package libcuda1-352.
    Preparing to unpack .../libcuda1-352_367.57-0ubuntu0.14.04.1_amd64.deb ...
    Unpacking libcuda1-352 (367.57-0ubuntu0.14.04.1) ...
    Selecting previously unselected package libcuda1-346.
    Preparing to unpack .../libcuda1-346_352.63-0ubuntu0.14.04.1_amd64.deb ...
    Unpacking libcuda1-346 (352.63-0ubuntu0.14.04.1) ...
    Selecting previously unselected package nvidia-opencl-icd-367.
    Preparing to unpack .../nvidia-opencl-icd-367_367.57-0ubuntu0.14.04.1_amd64.deb ...
    Unpacking nvidia-opencl-icd-367 (367.57-0ubuntu0.14.04.1) ...
    Selecting previously unselected package nvidia-opencl-icd-352.
    Preparing to unpack .../nvidia-opencl-icd-352_367.57-0ubuntu0.14.04.1_amd64.deb ...
    Unpacking nvidia-opencl-icd-352 (367.57-0ubuntu0.14.04.1) ...
    Selecting previously unselected package nvidia-opencl-icd-346.
    Preparing to unpack .../nvidia-opencl-icd-346_352.63-0ubuntu0.14.04.1_amd64.deb ...
    Unpacking nvidia-opencl-icd-346 (352.63-0ubuntu0.14.04.1) ...
    Selecting previously unselected package cuda-drivers.
    Preparing to unpack .../cuda-drivers_346.46-1_amd64.deb ...
    Unpacking cuda-drivers (346.46-1) ...
    Selecting previously unselected package cuda-runtime-7-0.
    Preparing to unpack .../cuda-runtime-7-0_7.0-28_amd64.deb ...
    Unpacking cuda-runtime-7-0 (7.0-28) ...
    Selecting previously unselected package cuda-7-0.
    Preparing to unpack ..././cuda-7-0_7.0-28_amd64.deb ...
    Unpacking cuda-7-0 (7.0-28) ...
    Selecting previously unselected package cuda.
    Preparing to unpack ..././cuda_7.0-28_amd64.deb ...
    Unpacking cuda (7.0-28) ...
    Processing triggers for man-db (2.6.7.1-1) ...
    Processing triggers for doc-base (0.10.5) ...
    Processing 1 added doc-base file...
    Processing triggers for gnome-menus (3.10.1-0ubuntu2) ...
    Processing triggers for desktop-file-utils (0.22-1ubuntu1) ...
    Processing triggers for bamfdaemon (0.5.1+14.04.20140409-0ubuntu1) ...
    Rebuilding /usr/share/applications/bamf-2.index...
    Processing triggers for mime-support (3.54ubuntu1) ...
    正在设置 nvidia-367 (367.57-0ubuntu0.14.04.1) ...
    update-alternatives: using /usr/lib/nvidia-367/ld.so.conf to provide /etc/ld.so.conf.d/x86_64-linux-gnu_EGL.conf (x86_64-linux-gnu_egl_conf) in 自动模式
    update-alternatives: using /usr/lib/nvidia-367/alt_ld.so.conf to provide /etc/ld.so.conf.d/i386-linux-gnu_EGL.conf (i386-linux-gnu_egl_conf) in 自动模式
    update-alternatives: using /usr/share/nvidia-367/glamor.conf to provide /usr/share/X11/xorg.conf.d/glamoregl.conf (glamor_conf) in 自动模式
    INFO:Enable nvidia-367
    DEBUG:Parsing /usr/share/ubuntu-drivers-common/quirks/put_your_quirks_here
    DEBUG:Parsing /usr/share/ubuntu-drivers-common/quirks/dell_latitude
    DEBUG:Parsing /usr/share/ubuntu-drivers-common/quirks/lenovo_thinkpad
    正在添加系统用户"nvidia-persistenced" (UID 117)...
    正在添加新组"nvidia-persistenced" (GID 125)...
    正在将新用户"nvidia-persistenced" (UID 117)添加到组"nvidia-persistenced"...
    无法创建主目录"/"
    Loading new nvidia-367-367.57 DKMS files...
    First Installation: checking all kernels...
    Building only for 3.13.0-32-generic
    Building for architecture x86_64
    Building initial module for 3.13.0-32-generic
    Done.
    
    nvidia_367:
    Running module version sanity check.
     - Original module
       - No original module exists within this kernel
     - Installation
       - Installing to /lib/modules/3.13.0-32-generic/updates/dkms/
    
    nvidia_367_modeset.ko:
    Running module version sanity check.
     - Original module
       - No original module exists within this kernel
     - Installation
       - Installing to /lib/modules/3.13.0-32-generic/updates/dkms/
    
    nvidia_367_drm.ko:
    Running module version sanity check.
     - Original module
       - No original module exists within this kernel
     - Installation
       - Installing to /lib/modules/3.13.0-32-generic/updates/dkms/
    
    nvidia_367_uvm.ko:
    Running module version sanity check.
     - Original module
       - No original module exists within this kernel
     - Installation
       - Installing to /lib/modules/3.13.0-32-generic/updates/dkms/
    
    depmod....
    
    DKMS: install completed.
    正在设置 nvidia-352 (367.57-0ubuntu0.14.04.1) ...
    正在设置 nvidia-346 (352.63-0ubuntu0.14.04.1) ...
    正在设置 libcuda1-367 (367.57-0ubuntu0.14.04.1) ...
    正在设置 ocl-icd-libopencl1:amd64 (2.1.3-4) ...
    正在设置 cuda-license-7-0 (7.0-28) ...
    *** 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-7.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.
    正在设置 cuda-misc-headers-7-0 (7.0-28) ...
    *** 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-7.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.
    正在设置 cuda-core-7-0 (7.0-28) ...
    *** 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-7.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.
    正在设置 cuda-cudart-7-0 (7.0-28) ...
    *** 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-7.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.
    正在设置 cuda-driver-dev-7-0 (7.0-28) ...
    *** 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-7.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.
    正在设置 cuda-cudart-dev-7-0 (7.0-28) ...
    *** 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-7.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.
    正在设置 cuda-command-line-tools-7-0 (7.0-28) ...
    *** 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-7.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.
    正在设置 cuda-nvrtc-7-0 (7.0-28) ...
    *** 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-7.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.
    正在设置 cuda-nvrtc-dev-7-0 (7.0-28) ...
    *** 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-7.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.
    正在设置 cuda-cusolver-7-0 (7.0-28) ...
    *** 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-7.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.
    正在设置 cuda-cusolver-dev-7-0 (7.0-28) ...
    *** 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-7.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.
    正在设置 cuda-cublas-7-0 (7.0-28) ...
    *** 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-7.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.
    正在设置 cuda-cublas-dev-7-0 (7.0-28) ...
    *** 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-7.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.
    正在设置 cuda-cufft-7-0 (7.0-28) ...
    *** 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-7.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.
    正在设置 cuda-cufft-dev-7-0 (7.0-28) ...
    *** 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-7.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.
    正在设置 cuda-curand-7-0 (7.0-28) ...
    *** 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-7.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.
    正在设置 cuda-curand-dev-7-0 (7.0-28) ...
    *** 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-7.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.
    正在设置 cuda-cusparse-7-0 (7.0-28) ...
    *** 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-7.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.
    正在设置 cuda-cusparse-dev-7-0 (7.0-28) ...
    *** 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-7.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.
    正在设置 cuda-npp-7-0 (7.0-28) ...
    *** 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-7.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.
    正在设置 cuda-npp-dev-7-0 (7.0-28) ...
    *** 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-7.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.
    正在设置 cuda-samples-7-0 (7.0-28) ...
    正在设置 cuda-documentation-7-0 (7.0-28) ...
    *** 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-7.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.
    正在设置 cuda-visual-tools-7-0 (7.0-28) ...
    *** 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-7.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.
    正在设置 cuda-toolkit-7-0 (7.0-28) ...
    *** 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-7.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.
    正在设置 nvidia-346-uvm (346.96-0ubuntu0.0.1) ...
    正在设置 nvidia-367-dev (367.57-0ubuntu0.14.04.1) ...
    正在设置 nvidia-352-dev (367.57-0ubuntu0.14.04.1) ...
    正在设置 nvidia-346-dev (352.63-0ubuntu0.14.04.1) ...
    正在设置 nvidia-modprobe (346.46-0ubuntu1) ...
    正在设置 nvidia-settings (346.46-0ubuntu1) ...
    正在设置 libcuda1-352 (367.57-0ubuntu0.14.04.1) ...
    正在设置 libcuda1-346 (352.63-0ubuntu0.14.04.1) ...
    正在设置 nvidia-opencl-icd-367 (367.57-0ubuntu0.14.04.1) ...
    正在设置 nvidia-opencl-icd-352 (367.57-0ubuntu0.14.04.1) ...
    正在设置 nvidia-opencl-icd-346 (352.63-0ubuntu0.14.04.1) ...
    正在设置 cuda-drivers (346.46-1) ...
    正在设置 cuda-runtime-7-0 (7.0-28) ...
    正在设置 cuda-7-0 (7.0-28) ...
    *** 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-7.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.
    
    *****************************************************************************************
    *** Please reboot your computer and verify that the nvidia graphics driver is loaded. ***
    *** If the driver fails to load, please use the NVIDIA graphics driver .run installer ***
    *** to get into a stable state.                                                       ***
    *****************************************************************************************
    正在设置 cuda (7.0-28) ...
    *** 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-7.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.
    Processing triggers for libc-bin (2.19-0ubuntu6) ...
 
        (3) 配置CUDA
        sudo vi /etc/profile 添加
         export PATH=/usr/local/cuda-7.0/bin:$PATH
         export LD_LIBRARY_PATH=/usr/local/cuda-7.0/lib64:$LD_LIBRARY_PATH
        
         添加cuda.conf
         sudo vim /etc/ld.so.conf.d/cuda.conf
   /usr/local/cuda/lib64
   /lib
 6.2 安装 cuda-toolkit
    好像没装,装了toolkit,检查一下
              nvcc --version
                     nvcc: NVIDIA (R) Cuda compiler driver
      Copyright (c) 2005-2015 NVIDIA Corporation
      Built on Mon_Feb_16_22:59:02_CST_2015
      Cuda compilation tools, release 7.0, V7.0.27
     如果有上述信息不用操做,否则执行:
 sudo apt-get install nvidia-cuda-toolkit
 安装失败,nvidia-cuda-toolkit : 依赖: nvidia-opencl-dev (= 5.5.22-3ubuntu1) 但是它将不
 
  重新执行一下, 6.3.1 问题处理,执行 nvcc --version,
  system@ubunt:~$ nvcc --version
  nvcc: NVIDIA (R) Cuda compiler driver
  Copyright (c) 2005-2015 NVIDIA Corporation
  Built on Mon_Feb_16_22:59:02_CST_2015
  Cuda compilation tools, release 7.0, V7.0.27
  一切正常

 6.3 安装sample(如果安装的是8.0需要先sudo apt-get remove --purge nvidia-375 nvidia-modprobe nvidia-settings 再sudo ./cuda_8.0.61_375.26_linux.run)
 cd  /usr/local/cuda-7.0/bin
 $ cuda-install-samples-7.0.sh

 这样,就将cuda的sample拷贝到dir文件夹下了。该命令只是一个拷贝操作。
 我的执行如下:
 $ cuda-install-samples-7.0.sh   /home/cudaSamples/
 cd /home/cudaSamples/
 $ make
    然后进入该文件夹,执行make命令进行编译,编译时间较长,需要等待。
    /usr/bin/ld: cannot find -lnvcuvid
   collect2: error: ld returned 1 exit status
    sudo sed -i "s/nvidia-346/nvidia-367/g" `grep nvidia-346 -rl ./`
    执行成功再次make 完成
   执行 /home/cuda7_sample/NVIDIA_CUDA-7.0_Samples/bin/x86_64/linux/release下的
    ./deviceQuery
     CUDA Device Query (Runtime API) version (CUDART static linking)

 modprobe: FATAL: Module nvidia-uvm not found.
 cudaGetDeviceCount returned 30
 -> unknown error
 Result = FAIL
 重启发现,系统不能正常显示,只出现log界面,崩溃!!!!
    6.3.1 问题处理如下:

  首先,之前使用bumblebee解决双显卡问题的需要卸载bumblebee。 
  (1) sudo apt-get purge bumblebee*  
  安装nvidia-367驱动和nvidia prime,这里先不管驱动的版本问题 
  (2). sudo stop lightdm 
  (3). sudo apt-get install nvidia-367 nvidia-prime   重装驱动   因该是
  切换到nvidia独显下安装CUDA 
  (3.5). sudo prime-select nvidia  应该是这步起作用了
  (3.8).sudo dpkg -i cuda-repo-ubuntu1404-7-0-local_7.0-28_amd64.deb  这步估计没用
  (4).sudo reboot 重启,
  (5).系统启动还报错,忽略
         ./deviceQuery
        
              ./deviceQuery Starting...

    CUDA Device Query (Runtime API) version (CUDART static linking)
   
   Detected 2 CUDA Capable device(s)
   
   Device 0: "Tesla K20c"
     CUDA Driver Version / Runtime Version          8.0 / 7.0
     CUDA Capability Major/Minor version number:    3.5
     Total amount of global memory:                 4742 MBytes (4972412928 bytes)
     (13) Multiprocessors, (192) CUDA Cores/MP:     2496 CUDA Cores
     GPU Max Clock rate:                            706 MHz (0.71 GHz)
     Memory Clock rate:                             2600 Mhz
     Memory Bus Width:                              320-bit
     L2 Cache Size:                                 1310720 bytes
     Maximum Texture Dimension Size (x,y,z)         1D=(65536), 2D=(65536, 65536), 3D=(4096, 4096, 4096)
     Maximum Layered 1D Texture Size, (num) layers  1D=(16384), 2048 layers
     Maximum Layered 2D Texture Size, (num) layers  2D=(16384, 16384), 2048 layers
     Total amount of constant memory:               65536 bytes
     Total amount of shared memory per block:       49152 bytes
     Total number of registers available per block: 65536
     Warp size:                                     32
     Maximum number of threads per multiprocessor:  2048
     Maximum number of threads per block:           1024
     Max dimension size of a thread block (x,y,z): (1024, 1024, 64)
     Max dimension size of a grid size    (x,y,z): (2147483647, 65535, 65535)
     Maximum memory pitch:                          2147483647 bytes
     Texture alignment:                             512 bytes
     Concurrent copy and kernel execution:          Yes with 2 copy engine(s)
     Run time limit on kernels:                     No
     Integrated GPU sharing Host Memory:            No
     Support host page-locked memory mapping:       Yes
     Alignment requirement for Surfaces:            Yes
     Device has ECC support:                        Enabled
     Device supports Unified Addressing (UVA):      Yes
     Device PCI Domain ID / Bus ID / location ID:   0 / 4 / 0
     Compute Mode:
        < Default (multiple host threads can use ::cudaSetDevice() with device simultaneously) >
   
   Device 1: "Quadro K420"
     CUDA Driver Version / Runtime Version          8.0 / 7.0
     CUDA Capability Major/Minor version number:    3.0
     Total amount of global memory:                 972 MBytes (1019215872 bytes)
     ( 1) Multiprocessors, (192) CUDA Cores/MP:     192 CUDA Cores
     GPU Max Clock rate:                            876 MHz (0.88 GHz)
     Memory Clock rate:                             891 Mhz
     Memory Bus Width:                              128-bit
     L2 Cache Size:                                 262144 bytes
     Maximum Texture Dimension Size (x,y,z)         1D=(65536), 2D=(65536, 65536), 3D=(4096, 4096, 4096)
     Maximum Layered 1D Texture Size, (num) layers  1D=(16384), 2048 layers
     Maximum Layered 2D Texture Size, (num) layers  2D=(16384, 16384), 2048 layers
     Total amount of constant memory:               65536 bytes
     Total amount of shared memory per block:       49152 bytes
     Total number of registers available per block: 65536
     Warp size:                                     32
     Maximum number of threads per multiprocessor:  2048
     Maximum number of threads per block:           1024
     Max dimension size of a thread block (x,y,z): (1024, 1024, 64)
     Max dimension size of a grid size    (x,y,z): (2147483647, 65535, 65535)
     Maximum memory pitch:                          2147483647 bytes
     Texture alignment:                             512 bytes
     Concurrent copy and kernel execution:          Yes with 1 copy engine(s)
     Run time limit on kernels:                     Yes
     Integrated GPU sharing Host Memory:            No
     Support host page-locked memory mapping:       Yes
     Alignment requirement for Surfaces:            Yes
     Device has ECC support:                        Disabled
     Device supports Unified Addressing (UVA):      Yes
     Device PCI Domain ID / Bus ID / location ID:   0 / 3 / 0
     Compute Mode:
        < Default (multiple host threads can use ::cudaSetDevice() with device simultaneously) >
   > Peer access from Tesla K20c (GPU0) -> Quadro K420 (GPU1) : No
   > Peer access from Quadro K420 (GPU1) -> Tesla K20c (GPU0) : No
   
   deviceQuery, CUDA Driver = CUDART, CUDA Driver Version = 8.0, CUDA Runtime Version = 7.0, NumDevs = 2, Device0 = Tesla K20c, Device1 = Quadro K420
   Result = PASS
        
         先看驱动检测
         system@Ubuntu14:/var/cache/apt/archives$ nvidia-smi
  Mon Dec 26 16:36:52 2016      
  +-----------------------------------------------------------------------------+
  | NVIDIA-SMI 367.57                 Driver Version: 367.57                    |
  |-------------------------------+----------------------+----------------------+
  | GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
  | Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
  |===============================+======================+======================|
  |   0  Quadro K420         Off  | 0000:03:00.0      On |                  N/A |
  | 25%   43C    P8    N/A /  N/A |    220MiB /   972MiB |      0%      Default |
  +-------------------------------+----------------------+----------------------+
  |   1  Tesla K20c          Off  | 0000:04:00.0     Off |                    0 |
  | 30%   33C    P8    17W / 225W |      0MiB /  4742MiB |      0%      Default |
  +-------------------------------+----------------------+----------------------+
                                                                                
  +-----------------------------------------------------------------------------+
  | Processes:                                                       GPU Memory |
  |  GPU       PID  Type  Process name                               Usage      |
  |=============================================================================|
  |    0      1457    G   /usr/bin/X                                     132MiB |
  |    0      2696    G   compiz                                          86MiB |
  +-----------------------------------------------------------------------------+
  
  6.43,安装cuDNN
 下载 cudnn-7.0-linux-x64-v3.0-prod.tgz,官网申请不到,网上自己找的,就不给地址了。
 [plain] view plain copy print?在CODE上查看代码片派生到我的代码片
 tar -zxvf  cudnn-7.0-linux-x64-v3.0-prod.tgz 
 cd cuda 
 sudo cp lib64/lib* /usr/local/cuda/lib64/ 
 sudo cp include/cudnn.h /usr/local/cuda/include/ 
 
 
 不用操作以下:
 sudo chmod u=rwx,g=rx,o=rx libcudnn.so.7.0.64
 sudo ln -s libcudnn.so.7.0.64 libcudnn.so.7.0
 sudo ln -s libcudnn.so.7.0  libcudnn.so
 
 同时需要添加lib库路径: 在 /etc/ld.so.conf.d/加入文件 cuda.conf, 内容如下
 /usr/local/cuda/lib64 
 保存后,执行下列命令使之立刻生效
 sudo ldconfig 
7、安装python
     7.1 不再安装python管理工具pyenv,跳过##错误##
           (1)安装git
                sudo apt-get install git
          ###### (2)安装python管理工具pyenv,这里我假设用用户system安装
            ######   sudo git clone git://github.com/yyuu/pyenv.git ~/.pyenv
           ######    切换到root用户
            ######   echo 'export PYENV_ROOT="/home/system/.pyenv"' >> /etc/profile
    ###### echo 'export PATH="/home/system/.pyenv/bin:$PATH"' >>  /etc/profile
    ###### echo 'eval "$(pyenv init -)"' >>  /etc/profile
    ###### source /etc/profile
     7.2python 编译安装
          (1)安装依赖库 
           安装git
                sudo apt-get install git
             sudo apt-get install -y make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm
               sudo apt-get install libc6-dev gcc
          (2)编译python
          pyenv install 2.7.12 -v 下载失败
          拷贝下载的源码安装
         XX sudo ./configure --enable-unicode=ucs4 --enable-shared cxxflags=-fPIC cflags=-fPIC --prefix=/usr/local/python 
          XX sudo ./configure --enable-unicode=ucs4 --enable-shared cxxflags=-fPIC cflags=-fPIC --prefix=/usr
          sudo ./configure --enable-unicode=ucs4 --enable-shared cxxflags=-fPIC cflags=-fPIC
         
          所以通常我们./configure的时候,默认是--prefix=/usr,这样的话,本程序的配置文件就会装到/usr/etc,应用文件就会安装到/usr/bin,本程序的私有库也会安装到/usr/lib等等,,我们也不用设置PATH就可以直接用了,,
          sudo make install
         
          (2.5)修改链接
            sudo mv /usr/bin/python /usr/bin/python2.7.6
     sudo ln -s /usr/local/bin/python2.7 /usr/bin/python
    a.需要编辑/etc/ld.so.conf增加一行/usr/local/lib
        sudo vim /etc/ld.so.conf
       
        include ld.so.conf.d/*.conf #原有的
        /usr/local/lib
   
   b.  ld.so.conf文件配置完毕后,我们需要执行如下命令:
    sudo /sbin/ldconfig
    sudo /sbin/ldconfig -v
    
   c. 然后再执行python -V命令,查看python版本如下
            Python 2.7.12
           (3)安装python的pip和easy_install(工具包 setuptools-32.3.0.zip ),方便安装软件包
    wget --no-check-certificate https://bootstrap.pypa.io/ez_setup.py
     python ez_setup.py --insecure
    wget https://bootstrap.pypa.io/get-pip.py
    sudo python get-pip.py

           (4)安装其他包
                a. numpy 安装
                 tar -xzvf numpy-1.12.0b1.tar.gz
                 cd numpy-1.12.0b1
                 sudo python setup.py install
                b. mock安装
                  tar -xzvf mock-2.0.0.tar.gz
                   cd mock-2.0.0/
                   sudo python setup.py install
                c. six安装
                      tar -xvzf six-1.10.0.tar.gz
                       cd six-1.10.0/
                       sudo python setup.py install
               d.  pbr.version安装
                    tar -xzvf pbr-1.10.0.tar.gz
                     cd pbr-1.10.0/
                     sudo python setup.py install
                e. funcsigs 安装
                   tar -xvzf funcsigs-1.0.2.tar.gz
                   cd funcsigs-1.0.2/
                    sudo python setup.py install
                f. atlas3 安装(没装)
                    tar -jxvf 
                    tar -jxvf atlas3.10.3.tar.bz2
                     cd ATLAS/
                    **************************************************
       mkdir build ; cd build
      ./ATLAS/configure [flags]
       make              ! tune and compile library
       make check        ! perform sanity tests
       make ptcheck      ! checks of threaded code for multiprocessor systems
       make time         ! provide performance summary as % of clock rate
       make install      ! Copy library and include files to other directories
    **************************************************
    编译过程出错,提示be due to shut off throttling ,放弃安装,可以通过进入bois修改对应选项再安装
    
             g.  boost_1_57_0 安装
              #sudo apt-get remove libboost-dev
     tar -jxvf boost_1_57_0.tar.bz2
     cd  boost_1_57_0/
    sudo ./bootstrap.sh
       修改tools/build/boost-build.jam   在最后面加上一行“using mpi ;”(注意mpi后面有个空格,然后一个分号 )
       sudo ./b2
       sudo ./b2 install --prefix=/usr
      h. dask安装
        tar -xzvf dask-0.12.0.tar.gz
        cd dask-0.12.0/
        sudo python setup.py install
     i.  easydict 安装
       unzip easydict-1.6.zip
       cd easydict-1.6/
       sudo python setup.py install
     j. Cython 安装
       tar -xzvf Cython-0.25.1.tar.gz
       cd Cython-0.25.1/
       sudo python setup.py install
     k. h5py  安装
       tar -xvzf h5py-2.6.0.tar.gz
       cd h5py-2.6.0/
       sudo python setup.py install
       缺少 hdf5.h 文件,下载 anaconda 安装
       bash Anaconda-2.1.0-Linux-x86_64.sh
    chmod +x Anaconda-2.1.0-Linux-x86_64.sh
    ./Anaconda-2.1.0-Linux-x86_64.sh
    m. ipython安装
      tar -xvzf ipython-5.1.0.tar.gz
      cd ipython-5.1.0/
      sudo python setup.py install
   n. lapack安装
           sudo apt-get install gfortran
          
     tar -xzvf lapack-3.5.0.tgz
     cd lapack-3.5.0/
     cp make.inc.example make.inc
     cd lapack-3.5.0/
     编辑Makefile 文件内容, 把
     lib: lapacklib tmglib
     #lib: blaslib variants lapacklib tmglib
     改为:
     #lib: lapacklib tmglib
     lib: blaslib variants lapacklib tmglib
      将生成的liblapack.a,librefblas.a,libtmglib.a 三个库拷贝到/usr/lib
          sudo cp liblapack.a /usr/lib
          sudo cp librefblas.a /usr/lib
          sudo cp libtmglib.a /usr/lib
       o. leveldb安装
           tar -xvzf leveldb-0.194.tar.gz
           cd leveldb-0.194/
           sudo python setup.py install
  p. matplotlib安装   ..... Math跳过去没装
     tar -xzvf matplotlib-1.4.2.tar.gz
     cd matplotlib-1.4.2/
     sudo python setup.py install
     报如下错误:
          * The following required packages can not be built:
                        * freetype, png
                   采用如下方法安装:
                   安装 :sudo apt-get install libpng-dev
                   下载 freetype-2.3.10.tar.bz2
                   tar -xjvf freetype-2.3.10.tar.bz2
                   cd freetype-2.3.10
                   sudo ./configure --prefix=/usr
                   sudo make
                   sudo make install
                  
                   再次执行:
                   sudo python setup.py install ,  另一种安装方式: sudo pip install matplotlib
                   测试安装成功 import matplotlib.pyplot as plt
                  
                   配置matploatlib
                   cd /usr/local/lib/python2.7/site-packages/matplotlib-1.4.2-py2.7-linux-x86_64.egg/matplotlib/mpl-data
    vi matplotlibrc
    #### CONFIGURATION BEGINS HERE

    # The default backend; one of GTK GTKAgg GTKCairo GTK3Agg GTK3Cairo
    # CocoaAgg MacOSX Qt4Agg Qt5Agg TkAgg WX WXAgg Agg Cairo GDK PS PDF SVG
    # Template.
    # You can also deploy your own backend outside of matplotlib by
    # referring to the module name (which must be in the PYTHONPATH) as
    # 'module://my_backend'.
    backend      : agg
    修改为:backend      : Qt4Agg
    
    在Ubuntu系统上安装PySide
    sudo add-apt-repository ppa:pyside
    sudo apt-get update
    sudo apt-get install python-pyside
    
    如果想只装某个模块:
    sudo apt-get install python-pyside.qtgui
    
    cd  /usr/lib/python2.7/dist-packages
     sudo cp -rf PyQt4 /usr/local/lib/python2.7/site-packages/
     sudo cp -rf PySide/ /usr/local/lib/python2.7/site-packages/
    
    使用下面的方法测试是否安装成功:
    >>> from PySide.QtCore import *
    >>> print QT_VERSION_STR  运行错误,忽略
    4.7.0
  q. networkx 安装
     tar -xzvf networkx-1.11.tar.gz   
     cd networkx-1.11/
     sudo python setup.py install
    
     自动安装了decorator库
       Best match: decorator 4.0.11
      Processing decorator-4.0.11.tar.gz
      Writing /tmp/easy_install-kCHNjB/decorator-4.0.11/setup.cfg
      Running decorator-4.0.11/setup.py -q bdist_egg --dist-dir /tmp/easy_install-kCHNjB/decorator-4.0.11/egg-dist-tmp-5NBa3d
      creating /usr/local/lib/python2.7/site-packages/decorator-4.0.11-py2.7.egg
      Extracting decorator-4.0.11-py2.7.egg to /usr/local/lib/python2.7/site-packages
      Adding decorator 4.0.11 to easy-install.pth file
      
      Installed /usr/local/lib/python2.7/site-packages/decorator-4.0.11-py2.7.egg
      Finished processing dependencies for networkx==1.11
    r. nose 安装
      tar -xvzf nose-1.3.7.tar.gz
      cd nose-1.3.7/
       sudo python setup.py install
    s. pandas 安装
       tar -xzvf pandas-0.19.1.tar.gz
       cd pandas-0.19.1/
       sudo python setup.py install
    t. pip  安装
       tar -xzvf pip-9.0.1.tar.gz
        cd pip-9.0.1/
     sudo python setup.py install
   u. pkgconfig安装
     tar -xvzf pkgconfig-1.1.0.tar.gz
     cd pkgconfig-1.1.0/
      sudo python setup.py install
    v.  protobuf安装
      unzip protobuf-2.5.0.zip
      cd protobuf-2.5.0/
      sudo ./configure --prefix=/usr   #漏掉了 --prefix 安装到/usr/local/lib有报错,将前一次安装的/usr/local/lib下的文件拷贝到/usr/lib****************************
      ************************************
      sudo make
      sudo make check
      sudo make install
      sudo ldconfig
      
      安装protobuf的Python支持
        cd python # 位于protobuf下
        python setup.py build
        sudo python setup.py test
        sudo python setup.py install
      验证 protoc --version
       #python
     >>>import google.protobuf

   w. pyparsing安装
       tar -xzvf pyparsing-2.1.10.tar.gz
       cd pyparsing-2.1.10/
       sudo python setup.py install
     x. python-dateutil安装
       tar -xvf python-dateutil-1.4.tar
     cd python-dateutil-1.4/
     sudo python setup.py install
    y. python-gflags安装
      tar -xzvf python-gflags-3.1.0.tar.gz
      cd python-gflags-3.1.0/
      sudo python setup.py install
    z. pytz
      tar -xvzf pytz-2016.7.tar.gz
      cd pytz-2016.7/
      sudo python setup.py install
    a1. scikit-image
      tar -xvzf scikit-image-0.12.3.tar.gz
      cd scikit-image-0.12.3/
      sudo python setup.py install
    b1. scipy
      tar -xvzf scipy-0.14.0.tar.gz
      cd scipy-0.14.0/
      #sudo python setup.py install    #LD_LIBRARY_PATH  报错,采用下面方式安装
      sudo apt-get install -y  python-scipy
      cd /usr/lib/python2.7/dist-packages
       sudo cp -rf scipy* /usr/local/lib/python2.7/site-packages/
        python
        >>> from scipy import *
    c1. opencv 安装
    sudo pip install opencv-python
    也可直接执行opencv_python-3.2.0.6-cp27-cp27mu-manylinux1_x86_64.whl,注意是cp27mu而不是m
    sudo pip install opencv_python-3.2.0.6-cp27-cp27mu-manylinux1_x86_64.whl
    测试安装
    python
    >>> import cv2
   
    d1. Wx图形库安装
    tar -jxvf wxPython-src-3.0.2.0.tar.bz2
    cd wxPython-src-3.0.2.0/
    sudo  ./configure  --prefix=/usr --with-gtk
    sudo make
    sudo make install
    sudo vi /etc/profile
    修改或添加上/home/system/source/wxPython-src-3.0.2.0
    PATH=$PATH:/home/system/source/wxPython-src-3.0.2.0
    LD_LIBRARY_PATH=/home/system/source/wxPython-src-3.0.2.0/lib:$LD_LIBRARY_PATH
    cd /usr/lib
    sudo ln -s /usr/local/lib/libwx_gtk2u_core-3.0.so.0.2.0
    cd wxPython
    sudo python setup.py build
    sudo python setup.py install
   
    cd /usr/include
    cp /home/system/source/wxPython-src-3.0.2.0/lib/wx/include/gtk2-unicode-3.0/wx/setup.h ./wx
    sudo cp -rf wx-3.0/wx ./
   
    如果有报错,记得安装以下包:
    sudo python setup.py install
    sudo apt-get install libghc-gstreamer-dev
    gtk2,gtk2-devel,python-devel,tk,tk-devel,gstreamer,gstreamer-devel,mesa-libGL-devel,
    mesa-libGLU-devel,mesa-libGLU,mesa-libGL,libSM,libSM-devel,gstreamer-plugins-base-devel
   
    错误的步骤,安装2.8.12.1,好像编译后ansi,不是unicode的
     tar -jxvf wxPython-src-2.8.12.1.tar.bz2
    cd wxPython-src-2.8.12.1/
    sudo  ./configure  --prefix=/usr --with-gtk --unicode=yes
    sudo make
    sudo make install
    cd wxPython
    sudo python setup.py build
    sudo python setup.py install
    sudo apt-get install python-wxtools
   
    checking for GST... configure: WARNING: GStreamer 0.10 not available, falling back to 0.8
   checking for GST... configure: WARNING: GStreamer 0.8/0.10 not available.
   configure: error: GStreamer not available
   Error running configure
   ERROR: failed building wxWidgets
   Traceback (most recent call last):
     File "build.py", line 1184, in cmd_build_wx
       wxbuild.main(wxDir(), build_options)
     File "/home/system/source/wxPython_Phoenix-3.0.3/buildtools/build_wxwidgets.py", line 368, in main
       "Error running configure")
     File "/home/system/source/wxPython_Phoenix-3.0.3/buildtools/build_wxwidgets.py", line 85, in exitIfError
       raise builder.BuildError(msg)
   BuildError
    /usr/include/wx/gtk/clipbrd.h:59:5: error: ‘GtkWidget’ does not name a type
    该报错网上提示是自带bug,改为安装3.0.2.0,但是由于安装了2.8,所以需要删除原有2.8,折腾了
   
   
    下面的安装包错误:
    tar -xzvf wx-3.0.3.tar.gz
    cd wxPython_Phoenix-3.0.3
   
   
    以下不对
    tar -xzvf wxWidgets-2.8.12.tar.gz
    cd wxWidgets-2.8.12/
    sudo  ./configure  --prefix=/usr  --with-gtk
    sudo make
    sudo make install
   
    安装出错:
    checking for GST... configure: WARNING: GStreamer 0.10 not available, falling back to 0.8
   checking for GST... configure: WARNING: GStreamer 0.8/0.10 not available.
   configure: error: GStreamer not available
   Error running configure
   ERROR: failed building wxWidgets
   Traceback (most recent call last):
     File "build.py", line 1184, in cmd_build_wx
       wxbuild.main(wxDir(), build_options)
     File "/home/system/source/wxPython_Phoenix-3.0.3/buildtools/build_wxwidgets.py", line 368, in main
       "Error running configure")
     File "/home/system/source/wxPython_Phoenix-3.0.3/buildtools/build_wxwidgets.py", line 85, in exitIfError
       raise builder.BuildError(msg)
   BuildError
   
   wx-config --list

     Default config is gtk2-unicode-2.8
   
     Default config will be used for output
   
     Also available in /usr:
       wx-config
      
      删除所有与gtk2-unicode-2.8有关的文件和文件夹,重新安装 sudo make install
  
   其他错误处理
    configure: error: GStreamer not available
   
    ubuntu14.04安装GStreamer插件
   
    sudo apt-get install libghc-gstreamer-dev
   
    以下不对,记录下走错的路:
    sudo add-apt-repository ppa:mc3man/trusty-media
    sudo apt-get update
    sudo apt-get install gstreamer0.10-ffmpeg
   
    e1. mysql-connector-python安装
         也折腾了一下,不知道怎么搞的以前pip install mysql-connector-python-rf==2.1.3和deb包安装都可以,没办法下载一个2.1.4安装
     unzip mysql-connector-2.1.4.zip
     cd mysql-connector-2.1.4/
     sudo python setup.py install
    
     测试:
     python
     >>>
     import mysql.connector
    
     f1. 安装yaml
     前面包安装中,已经安装

              
           (5)更改环境变量
                export PYTHONPATH=/usr/local/lib/python2.7:/usr/local/lib/python2.7/site-packages:/usr/local/lib/python2.7/plat-linux2:/usr/local/lib/python2.7/lib-tk:/usr/local/lib/python2.7/lib-dynload
                export PYTHONHOME=/usr/local/lib/python2.7
               错误:     ImportError: No module named _io
               sudo pip install virtualenv --upgrade
     这次还会报错首先会报一个PIC的错误还有/usr/local/lib/libboost_python.so: undefined reference to `PyUnicodeUCS4_AsWideChar'
    这时因为caffe需要用UCS4编码格式,但是我们的Python环境是UCS2的所以需要卸载掉我们环境里的所有Python,sudo apt-get remove Python(如果卸载失败需要手动删除比较麻烦),然后手动下载Python的源码包进行编译安装
 进入源码目录
 ./configure --enable-unicode=ucs4 --enable-shared cxxflags=-fPIC cflags=-fPIC
 Make;sudo make install
 进入Python环境 >>>import sys   >>>print(sys.maxunicode)看下打印是不是1114111
 
 


 
 (6)安装完Python我们还需要重装boost
  sudo apt-get remove libboost-dev
   tar -jxvf boost_1_57_0.tar.bz2
  sudo ./bootstrap.sh
    修改tools/build/boost-build.jam   在最后面加上一行“using mpi ;”(注意mpi后面有个空格,然后一个分号 )
    sudo ./b2
  
   mock安装
   matplotlib安装
    sudo python setup.py install
 
 python删除
 sudo apt-get remove Python 卸载的是2.7.6
 python3.4删除
    sudo rm -rf /usr/local/lib/python3.4/
 sudo  rm -rf  /usr/lib/python3*
 sudo rm -rf /usr/bin/python*
 如上操作后,报    /usr/bin/python3: 坏的解释器: 没有那个文件或目录
 残暴处理
 mkdir /usr/bin/bakpython
 sudo mv -rf /usr/bin/python /usr/bin/bakpython
 sudo cp -rf /usr/local/bin/python* /usr/bin/
 sudo ln -s   /usr/bin/python2.7 /usr/bin/python3
 
 pyenv global 2.7.12 报错,说没安装 ,放弃
 
 
 Fatal Python error: Py_Initialize: Unable to get the locale encoding
  File "/usr/local/lib/python2.7/encodings/__init__.py", line 123
   raise CodecRegistryError,\
                            ^
SyntaxError: invalid syntax
  vi   /etc/grub.d10_linux
  linux ${rel_dirname}/${basename} root=${LINUX_HOST_DEVICE} loop=${loop_file_relative} ro ${args} //修改前
  linux ${rel_dirname}/${basename} root=${LINUX_HOST_DEVICE} loop=${loop_file_relative} rw ${args}
  sudo update-grub
 
 7.3安装 Tkinter
  sudo easy_install Tkinter
      sudo pip install Tkinter
      sudo apt-get install aptitude
  
  sudo apt-get install python-tk
  
  
 
8、安装caffe
 http://www.cnblogs.com/kunyuanjushi/p/5947066.html
 http://blog.csdn.net/lu597203933/article/details/46742199
 http://www.cnblogs.com/CarryPotMan/p/5392284.html
 我参考网址:https://www.zybuluo.com/hanxiaoyang/note/364737
 8.1 安装依赖包
   sudo apt-get install libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libhdf5-serial-dev protobuf-compiler
              sudo apt-get install --no-install-recommends libboost-all-dev
              sudo apt-get install libgflags-dev libgoogle-glog-dev liblmdb-dev
             
              sudo apt-get install OpenBLAS*  #本人忘记按这个了
             
 8.2下载
 git clone https://github.com/BVLC/caffe
    
     8.3 安装python依赖(路径根据自己的目录可能要调一下)
      切换到root用户下执行,否则可能出现类似如下错误:
      IOError: [Errno 13] 权限不够: '/usr/local/lib/python2.7/site-packages/cython.py'的错误,当然也可以对 /usr/local/lib/python2.7/site-packages权限进行调整
    
     cd caffe/python
     执行
      for req in $(cat requirements.txt); do pip install $req; done
      这步安装也有点慢,别急,等会儿,先去干点别的 ^_^

      8.4编辑caffe所需的Makefile文件

   cd caffe
   cp Makefile.config.example Makefile.config
   vim Makefile.config
   Makefile.config里面有依赖库的路径,及各种编译配置,如果是没有GPU的情况下,可以参照我下面帮你改的配置文件内容:
  
  ## Refer to http://caffe.berkeleyvision.org/installation.html
  # Contributions simplifying and improving our build system are welcome!
  
  # cuDNN acceleration switch (uncomment to build with cuDNN).
  # USE_CUDNN := 1
  
  # CPU-only switch (uncomment to build without GPU support).
  CPU_ONLY := 1
  
  # uncomment to disable IO dependencies and corresponding data layers
  # USE_OPENCV := 0
  # USE_LEVELDB := 0
  # USE_LMDB := 0
  
  # uncomment to allow MDB_NOLOCK when reading LMDB files (only if necessary)
  #       You should not set this flag if you will be reading LMDBs with any
  #       possibility of simultaneous read and write
  # ALLOW_LMDB_NOLOCK := 1
  
  # Uncomment if you're using OpenCV 3
  # OPENCV_VERSION := 3
  
  # To customize your choice of compiler, uncomment and set the following.
  # N.B. the default for Linux is g++ and the default for OSX is clang++
  # CUSTOM_CXX := g++
  
  # CUDA directory contains bin/ and lib/ directories that we need.
  CUDA_DIR := /usr/local/cuda
  # On Ubuntu 14.04, if cuda tools are installed via
  # "sudo apt-get install nvidia-cuda-toolkit" then use this instead:
  # CUDA_DIR := /usr
  
  # CUDA architecture setting: going with all of them.
  # For CUDA < 6.0, comment the *_50 lines for compatibility.
  CUDA_ARCH := -gencode arch=compute_20,code=sm_20 \
                  -gencode arch=compute_20,code=sm_21 \
                 -gencode arch=compute_30,code=sm_30 \
                 -gencode arch=compute_35,code=sm_35 \
                  -gencode arch=compute_50,code=sm_50 \
                  -gencode arch=compute_50,code=compute_50
  
  # BLAS choice:
  # atlas for ATLAS (default)
  # mkl for MKL
  # open for OpenBlas
  #BLAS := atlas
  BLAS := open
  # Custom (MKL/ATLAS/OpenBLAS) include and lib directories.
  # Leave commented to accept the defaults for your choice of BLAS
  # (which should work)!
  # BLAS_INCLUDE := /path/to/your/blas
  # BLAS_LIB := /path/to/your/blas
  
  # Homebrew puts openblas in a directory that is not on the standard search path
  # BLAS_INCLUDE := $(shell brew --prefix openblas)/include
  # BLAS_LIB := $(shell brew --prefix openblas)/lib
  BLAS_INCLUDE := /usr/include/openblas
  
  # This is required only if you will compile the matlab interface.
  # MATLAB directory should contain the mex binary in /bin.
  # MATLAB_DIR := /usr/local
  # MATLAB_DIR := /Applications/MATLAB_R2012b.app
  
  # NOTE: this is required only if you will compile the python interface.
  # We need to be able to find Python.h and numpy/arrayobject.h.
  PYTHON_INCLUDE := /usr/include/python2.7 \
                 /usr/lib/python2.7/dist-packages/numpy/core/include
  # Anaconda Python distribution is quite popular. Include path:
  # Verify anaconda location, sometimes it's in root.
  # ANACONDA_HOME := $(HOME)/anaconda
  # PYTHON_INCLUDE := $(ANACONDA_HOME)/include \
                  # $(ANACONDA_HOME)/include/python2.7 \
                  # $(ANACONDA_HOME)/lib/python2.7/site-packages/numpy/core/include \
  
  # We need to be able to find libpythonX.X.so or .dylib.
  PYTHON_LIB := /usr/lib
  # PYTHON_LIB := $(ANACONDA_HOME)/lib
  
  # Homebrew installs numpy in a non standard path (keg only)
  # PYTHON_INCLUDE += $(dir $(shell python -c 'import numpy.core; print(numpy.core.__file__)'))/include
  # PYTHON_LIB += $(shell brew --prefix numpy)/lib
  
  # Uncomment to support layers written in Python (will link against Python libs)
  WITH_PYTHON_LAYER := 1
  
  # Whatever else you find you need goes here.
  INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include
  LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib
  # If Homebrew is installed at a non standard location (for example your home directory) and you use it for general dependencies
  # INCLUDE_DIRS += $(shell brew --prefix)/include
  # LIBRARY_DIRS += $(shell brew --prefix)/lib
  
  # Uncomment to use `pkg-config` to specify OpenCV library paths.
  # (Usually not necessary -- OpenCV libraries are normally installed in one of the above $LIBRARY_DIRS.)
  # USE_PKG_CONFIG := 1
  
  BUILD_DIR := build
  DISTRIBUTE_DIR := distribute
  
  # Uncomment for debugging. Does not work on OSX due to https://github.com/BVLC/caffe/issues/171
  # DEBUG := 1
  
  # The ID of the GPU that 'make runtest' will use to run unit tests.
  TEST_GPUID := 0
  
  # enable pretty build (comment to see full commands)
  Q ?= @

     8.4 编译caffe
         make -j8
        
        报如下错误
        /usr/bin/ld: cannot find -lcblas /usr/bin/ld: cannot find -latlas。
        这是由于atlas安装在/usr/lib和/usr/include里面,cd到这个路径下,如果发现只有libblas.so,没有libatlas.so和libcblas.so,那就需要输入以下命令手动建立链接:
         sudo ln -sf ./libblas.so.3 ./libatlas.so
         sudo ln -sf ./libblas.so.3 ./libcblas.so

        ?测试一下编译结果
        sudo make test  -j16
        sudo make runtest  -j16
        [----------] 1 test from HDF5OutputLayerTest/0, where TypeParam = caffe::CPUDevice
  [ RUN      ] HDF5OutputLayerTest/0.TestForward
  [       OK ] HDF5OutputLayerTest/0.TestForward (1 ms)
  [----------] 1 test from HDF5OutputLayerTest/0 (1 ms total)
  
  [----------] Global test environment tear-down
  [==========] 2037 tests from 267 test cases ran. (596193 ms total)
  [  PASSED  ] 2037 tests.
 
       8.5.编译pycaffe

  sudo make pycaffe -j16
  
  
  
  /home/caffe/build/tools/caffe train \
    --solver=/home//mnist_solver.prototxt  2>&1 | tee ./mnist_model/cy.txt
   
    /home/system/caffe/build/tools/caffe train --solver=/home/mnist_solver.prototxt  2>&1 | tee ./mnist_model/cy.txt
    cd   /home/system/caffe/
    ./data/mnist/get_mnist.sh # 下载数据
     /home/system/caffe/examples/mnist/train_lenet.sh
     注意下载数据
  
     8.6 安装fast-rcnn
     参考
     http://blog.csdn.net/u014696921/article/details/52703586
    
      git clone --recursive https://github.com/rbgirshick/fast-rcnn.git
     
      'bcd9b4eadc7d8fbc433aeefd564e82ec63aaf69c'
      ‘0dcd397b29507b8314e252e850518c5695efbb83’
     
      ~/source/caffe-fast-rcnn
      cp Makefile.config.example Makefile.config
      sudo make -j8 2>&1|tee make.log
      sudo make pycaffe  2>&1|tee make.log
     
      下载Fast RCNN检测器
      ./data/scripts/fetch_fast_rcnn_models.sh
  
9、安装mysql-connetor(连接mysql 数据库使用,可以不安装)
  1、使用pip install mysql-connector-python-rf==2.1.3进行安装
  2、使用下载的离线文件(本次使用该方法安装失败,建议使用方法1,应该是python不认)
  mysql-connector-python_2.2.0-1ubuntu14.04_all.deb
  dpkg -i mysql-connector-python_2.2.0-1ubuntu14.04_all.deb
  或
  mysql-connector-python-2.1.3-1.el6.x86_64.rpm
  rpm -ivh mysql-connector-python-2.1.3-1.el6.x86_64.rpm
  
  离线安装完成后,执行如下命令:
  cp -r /usr/lib/python2.7/dist-packages/*mysql* /usr/local/lib/python2.7/site-packages/
  cd /usr/local/lib/python2.7/site-packages/
  ls -l *mysq*
  
  一定要有如下信息,mysql 和 mysql_connector_python_rf-2.1.3.dist-info 文件夹
  mysql:
  total 8
  drwxr-sr-x 5 root staff 4096 Aug 25 16:20 connector
  -rw-r--r-- 1 root staff    0 Aug 25 16:20 __init__.py
  -rw-r--r-- 1 root staff  197 Aug 25 16:20 __init__.pyc
  
  mysql_connector_python_rf-2.1.3.dist-info:
  total 32
  -rw-r--r-- 1 root staff  139 Aug 25 16:20 DESCRIPTION.rst
  -rw-r--r-- 1 root staff    4 Aug 25 16:20 INSTALLER
  -rw-r--r-- 1 root staff 1466 Aug 25 16:20 METADATA
  -rw-r--r-- 1 root staff 1363 Aug 25 16:20 metadata.json
  -rw-r--r-- 1 root staff 5568 Aug 25 16:20 RECORD
  -rw-r--r-- 1 root staff    6 Aug 25 16:20 top_level.txt
  -rw-r--r-- 1 root staff  104 Aug 25 16:20 WHEEL

 

10、解决ubuntu新建用户后,tab键不能使用的问题
 时间:2015-11-12来源:linux网站 作者:期待一片自己的蓝天
 一、新建用户  support
 adduser 新建用户的名字
 passwd  新建用户的名字即可添加新用户

 二、创建家目录
 # cd /home
 1.创建家目录:
 # mkdir 新建用户的名字
 2.拷贝环境变量模板文件:
 # cp /etc/skel/.b* support
 # cp /etc/skel/.p* support
 3.修改权限
 # chown -R support:support support
 # chmod 770 support
 
 三、赋予ROOT权限
 方法一: 修改 /etc/sudoers 文件,找到下面一行,把前面的注释(#)去掉
 ## Allows people in group wheel to run all commands
 %wheel    ALL=(ALL)    ALL
 然后修改用户,使其属于root组(wheel),命令如下:
 #usermod -g root 用户名
 修改完毕,现在可以用新建的用户名帐号登录,然后用命令 su - ,即可获得root权限进行操作。
 方法二: 修改 /etc/sudoers 文件,找到下面一行,在root下面添加一行,如下所示:
 ## Allow root to run any commands anywhere
 root    ALL=(ALL)     ALL
 新建用户的名字   ALL=(ALL)     ALL
 修改完毕,现在可以用新建的用户名字帐号登录,然后用命令 sudo su -,即可获得root权限进行操作。
 
 四、不能使用TAB键、上下键,命令行不显示当前路径的解决
 因默认ubuntu创建的普通帐号,默认shell为/bin/sh,而这不支持tab等键的,所以将「指定用户」帐号的shell改为/bin/bash就可以了。
 1.查看当前的shell:
 # echo $SHELL
 /bin/sh
 2.修改shell为/bin/bash:
 # usermod -s /bin/bash 用户名
11、查看系统驱动和信息
 11.1显卡驱动
  lspci | grep -i nvidia
  11.2系统信息
  uname -m && cat /etc/*release
 
12.ubuntu开机只有桌面,没有菜单栏和任务栏,只有壁纸
      sudo apt-get install unity --fix-missing
13、修改IP地址和机器名称
修改机器名和IP地址

1、gedit /etc/hostname
2、gedit /etc/hosts
3、gedit /etc/network/interfaces
添加内容如下(根据自己的需要修改):

auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 10.1.132.233
netmask 255.255.255.0
gateway 10.1.132.1
dns-nameservers 10.36.8.40 10.36.8.41

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