1. 程式人生 > >1.ubuntu16.04/14.04安裝caffe

1.ubuntu16.04/14.04安裝caffe

Ubuntu16.04

ubuntu16.04在1060上安裝完成後會有無法進入系統的狀況

在ubuntu啟動介面按e鍵進入編輯模式 把所有的quiet splash前面加入nomodeset按f10鍵選擇第一個ubuntu系統進入,進入後編輯 sudo gedit /etc/default/grub GRUB_CMDLINE_LINUX_DEFAULT=“quiet splash” 改為 GRUB_CMDLINE_LINUX_DEFAULT=“quiet splash nomodeset” 然後 sudo update-grub sudo reboot cuda8.0及其cudnn的的安裝方法同ubuntu14.04(郭佳偉QQ空間)(如果安裝出錯 先安裝驅動後重啟,再安裝cuda,不安裝驅動)

安裝搜狗輸入法:

下載搜狗linux.deb
    sudo dpkg -i sogou.deb
    sudo apt-get install -f
登出不用重啟
開啟fictx配置,sogou

一、CUDA+CUDNN的安裝

(1)顯示卡驅動

安裝顯示卡驅動 sudo ./NVIDIA-Linux-x86_64-390.59.run -no-opengl-files 解除安裝顯示卡驅動 sudo apt-get autoremove --purge nvidia-* (2)cuda sudo ./cuda… (3)CuDnn

(1)#
	cd cuda/include
	sudo cp cudnn.h /usr/local/cuda/include/ 
(2)# 
	cd ../lib64 
	sudo cp lib* /usr/local/cuda/lib64/ 
	cd /usr/local/cuda/lib64/ 
	sudo rm -rf libcudnn.so libcudnn.so.5
	sudo ln -s libcudnn.so.5.1.10 libcudnn.so.5
	sudo ln -s libcudnn.so.5 libcudnn.so 
	sudo chmod a+x /usr/local/cuda/include/cudnn.h  /usr/local/cuda/lib64/libcudnn*

(4)Path 配置:

[1] sudo gedit /etc/profile
    export PATH=/usr/local/cuda-8.0/bin:$PATH
    export  LD_LIBRARY_PATH=/usr/local/cuda-8.0/lib64:$LD_LIBRARY_PATH
[2] source /etc/profile //使之生效命令

(5)建立連結檔案: sudo gedit /etc/ld.so.conf #新增 /usr/local/cuda/lib64 sudo ldconfig #生效,現在重啟電腦!

(6)nvcc -V

二、caffe安裝

(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 libopenblas-dev liblapack-dev libatlas-base-dev sudo apt-get install libgflags-dev libgoogle-glog-dev liblmdb-dev sudo apt-get install git cmake build-essential python-tk opencv安裝 sudo apt-get install libopencv-dev python-opencv libcv-dev

(2)安裝和升級pip: sudo apt-get install python-pip python-dev pip install pip --upgrade

(3)pip安裝python庫 與requirements內相同但是不要版本號,sudo pip install (以下) Cython numpy scipy scikit-image matplotlib ipython h5py leveldb networkx nose pandas protobuf python-gflags pyyaml Pillow six

(4)caffe,caffe-ssd,caffe-ssd-mobile原始碼下載 [1] 修改Makefile.config

USE_CUDNN := 1
OPENCV_VERSION := 2
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
修改為:
INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include /usr/include/hdf5/serial
LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib  /usr/lib/x86_64-linux-gnu /usr/lib/x86_64-linux-gnu/hdf5/serial
 
#     
 -gencode arch=compute_20,code=sm_20
#     
 -gencode arch=compute_31,code=sm_31 \

[2] 編譯安裝 make all -j8 make pycaffe -j8 [3] 環境變數設定 export PYTHONPATH=/SSD所在目錄/caffe/python

三、Ubuntu 16.04上安裝QT

https://blog.csdn.net/hansion3333/article/details/60468590

ubuntu14.04

一、CUDA

(1)拉黑nouveau sudo gedit /etc/modprobe.d/blacklist-nouveau.conf 在blacklist-nouveau.conf檔案中輸入下面內容並儲存 blacklist nouveau options nouveau modeset=0

儲存完後還需要更新,在終端輸入命令: sudo update-initramfs -u lsmod | grep nouveau 禁用成功 (2)終端輸入命令: 按Ctrl+Alt+F1 sudo service lightdm stop (3)正式安裝cuda 用cd 命令切換到.run檔案所在資料夾下 sudo sh cuda_7.5.18_linux.run 重新啟動圖形化介面: sudo service lightdm start (4)Path 配置

[1] sudo gedit /etc/profile
    export PATH=/usr/local/cuda-8.0/bin:$PATH
    export  LD_LIBRARY_PATH=/usr/local/cuda-8.0/lib64:$LD_LIBRARY_PATH
[2] source /etc/profile //使之生效命令

(5)建立連結檔案: sudo gedit /etc/ld.so.conf #新增 /usr/local/cuda/lib64 sudo ldconfig #生效,現在重啟電腦! (6)nvcc -V

二、安裝終端 sudo apt-get install nautilus-open-terminal

三、安裝庫

sudo pip install six --upgrade --ignore-installed six sudo pip install -r requirements.txt

sudo apt-get install -y git libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libhdf5-serial-dev protobuf-compiler libatlas-base-dev python-dev libgflags-dev libgoogle-glog-dev liblmdb-dev

sudo apt-get install libboost1.55-dev libboost1.55-all-dev

四、opencv安裝

sudo apt-get install libcv-dev libopencv-dev python-opencv

測試opencv是否安裝成功

python
>>import cv2
>>cv2.__version__

五、CUDA+CuDnn安裝

CUDA安裝 (1)拉黑nouveau sudo gedit /etc/modprobe.d/blacklist-nouveau.conf 在blacklist-nouveau.conf檔案中輸入下面內容並儲存 blacklist nouveau options nouveau modeset=0 儲存完後還需要更新 在終端輸入命令: sudo update-initramfs -u lsmod | grep nouveau 禁用成功 (2)終端輸入命令: 按Ctrl+Alt+F1 sudo service lightdm stop (3)正式安裝cuda 用cd 命令切換到.run檔案所在資料夾下 sudo sh cuda_7.5.18_linux.run 重新啟動圖形化介面: sudo service lightdm start (4)Path 配置:

終端輸入命令:
    sudo gedit /etc/profile
在文字中新增
export PATH=/usr/local/cuda-8.0/bin:$PATH
export  LD_LIBRARY_PATH=/usr/local/cuda-8.0/lib64:$LD_LIBRARY_PATH
source /etc/profile //使之生效命令

(5)建立連結檔案: sudo gedit /etc/ld.so.conf #新增 /usr/local/cuda/lib64 sudo ldconfig #生效,現在重啟電腦! (6) source /etc/profile nvcc -V

CuDnn安裝 (1)# cd cuda/include sudo cp cudnn.h /usr/local/cuda/include/

(2)# cd …/lib64 sudo cp lib* /usr/local/cuda/lib64/ cd /usr/local/cuda/lib64/ sudo rm -rf libcudnn.so libcudnn.so.5 sudo ln -s libcudnn.so.5.1.10 libcudnn.so.5 sudo ln -s libcudnn.so.5 libcudnn.so sudo chmod a+x /usr/local/cuda/include/cudnn.h /usr/local/cuda/lib64/libcudnn*

六、安裝Caffe

(1)下載程式碼 git clone https://github.com/BVLC/caffe.git cd caffe cp Makefile.config.example Makefile.config

(2)編譯 make all -j8 make pycaffe -j8