Ubuntu 16.04 LTS, 64bit,cuda 8, Caffe环境配置编译和安装
1 GPU設備
1.1 本人使用的GPU設備
名稱: 七彩虹GTX980Ti顯卡iGame980Ti烈焰戰神X 6G
1.2 硬件問題
Laboratory Tested Hardware:
???? Berkeley Vision runs Caffe with K40s, K20s, and Titans including models at ImageNet/ILSVRC scale. We also run on GTX series cards and GPU-equipped MacBook Pros. We have not encountered any trouble in-house with devices with CUDA capability >= 3.0. All reported hardware issues thus-far have been due to GPU configuration, overheating, and the like.
CUDA compute capability:
???? 如果設備的運算能力 <= 2.0, 受限于設備的性能, 可能需要減少 CUDA的線程數量 和 批處理的 大小(sizes). 你的吞吐量可能會發生變化.
?
安裝后, 參照我們的 reference performance numbers 確保所有的配置是正確的.
工程問題請參照? hardware/compatibility.
?
2 GPU驅動、GPU開發工具安裝、Cudnn
?
2.1 基于cuda_8.0.44_linux2.run安裝
下載地址: http://blog.csdn.net/real_myth/article/details/52724892
?
2.2 cudnn-8.0-linux-x64-v5.1.tgz
install path: /usr/local/cuda-8.0/
其中,/usr/local/cuda/是軟連接,指向/usr/local/cuda-8.0/
?
3 Caffe
3.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-devCUDA: 通過apt-get 或者 NVIDIA 的 .run 包安裝.NVIDIA的包一般包含最新的庫和驅動版本,但是安裝需要手動設置.如果通過做安裝包安裝,依賴庫和驅動可以分別獨立的安裝; 驅動綁定的依賴庫可能會比較舊,但是對于只使用CPU的模式可以跳過.
BLAS: 安裝 ATLAS 通過 sudo apt-get install libatlas-base-dev 或者 install OpenBLAS 或者 MKL(較好的CPU性能)完成.
Python (可選): 如果使用默認的Python,用于 pycaffe接口Python頭文件安裝方式:sudo apt-get install python-dev.
3.2 兼容性 16.04
Ubuntu 16.04需要安裝CUDA 8
Ubuntu 14.04剩余的依賴
在版本 14.04下都是依賴包的方式.
sudo apt-get install libgflags-dev libgoogle-glog-dev liblmdb-devUbuntu 12.04剩余的依賴
在12.04下需要手工安裝.
# glog wget https://google-glog.googlecode.com/files/glog-0.3.3.tar.gz tar zxvf glog-0.3.3.tar.gz cd glog-0.3.3 ./configure make && make install # gflags wget https://github.com/schuhschuh/gflags/archive/master.zip unzip master.zip cd gflags-master mkdir build && cd build export CXXFLAGS="-fPIC" && cmake .. && make VERBOSE=1 make && make install # lmdb git clone https://github.com/LMDB/lmdb cd lmdb/libraries/liblmdb make && make install注意: glog 和最新的 gflags 版本 (2.1)不兼容, 所以要先給予 glog 編譯.
?
4 編譯
4.1 Makefile
現在已經具備了所有的依賴條件, 編輯你的配置文件?Makefile.config,改變你的安裝路徑?(you should especially uncomment and setBLAS_LIB accordingly on distributions likeCentOS / RHEL / Fedora where ATLAS is installed under/usr/lib[64]/atlas),默認的配置是可以的,但是如果你使用的是Anaconda Python,請解注釋相關的行。
cp Makefile.config.example Makefile.config # Adjust Makefile.config (for example, if using Anaconda Python) make all make test make runtest編譯的時候如果要引入cuDNN加速,你需要在文件Makefile.config中解注釋USE_CUDNN := 1。
如果你的電腦上沒有 GPU,你應該使用CPU-only模式的Caffe,請在文件Makefile.config中解注釋CPU_ONLY := 1?。
要編譯 Python 和 MATLAB 包,請獨立的執行make pycaffe和make matcaffe?. 請務必首先在Makefile.config中配置你的MATLAB 和 Python路徑!
Distribution: 運行 make distribute來創建一個包含所有的Caffe 頭文件, 編譯好的依賴庫,二進制文件等的分布式路徑,用于其他機器的配置.
Speed: 如果要快速的編譯,請通過make all -j8的方式并行編譯,其中8是并行編譯的線程的數量(并行線程的數量最好等于你機器CPU核的數量).
到目前為止,你已經安裝了Caffe, 請參照 MNIST tutorial 和 reference ImageNet model tutorial進行進一步的操作.
4.2 使用CMake (beta)編譯
通過手工編輯Makefile.config的方式告訴 Caffe 尋找依賴的的位置, Caffe 也提供了一個基于 CMake的編譯系統 (currently in “beta”).要求CMake 版本 >= 2.8.8. 基本的安裝步驟如下:
mkdir build cd build cmake .. make allmake runtest?
See PR #1667 for options and details.
?
?
?
總結
以上是生活随笔為你收集整理的Ubuntu 16.04 LTS, 64bit,cuda 8, Caffe环境配置编译和安装的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Ubuntu 14.04 LTS, 64
- 下一篇: Caffe: LMDB 及其数据转换