基於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 <dir>

 這樣,就將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<float>
  [ 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

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章