UbuntuServer14.04+CUDA7.5+CuDNNv3+Caffe+OpenCV3.0+配置

基本依賴項

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  

 

NVIDIA驅動

sudo apt-get install nvidia-current  

 

CUDA

先安裝內核頭文件:python

sudo apt-get install linux-headers-$(uname -r)  

 

安裝cuda(官網下載deb文件):linux

sudo dpkg -i cuda-repo-<distro>_<version>_<architecture>.deb  
sudo apt-get update  
sudo apt-get install cuda  

 

環境變量:git

export PATH=/usr/local/cuda-7.5/bin:$PATH  
export LD_LIBRARY_PATH=/usr/local/cuda-7.5/lib64:$LD_LIBRARY_PATH  

 

測試:github

cuda-install-samples-7.5.sh  ~  
cd ~/NVIDIA_CUDA-7.5_Samples  
cd 1_Utilities/deviceQuery  
make  

 

執行deviceQuery,若是成功結尾會是Result = PASSapp

cuda環境配置:測試

sudo nano /etc/ld.so.conf.d/cuda.conf  
    /usr/local/cuda/lib64
    /lib

 

完成lib文件的連接操做,執行:ui

sudo ldconfig -v  

 

BLAS

sudo apt-get install libatlas-base-dev  

 

其餘依賴項

sudo apt-get install libgflags-dev libgoogle-glog-dev liblmdb-dev  

 

OpenCV

#[compiler]
sudo apt-get install build-essential  
#[required]
sudo apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev  
#[optional]
sudo apt-get install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev  

 

能夠下載opencv的包解壓,也能夠用最新代碼:google

git clone https://github.com/Itseez/opencv.git  
cd ~/opencv  
mkdir build  
cd build  

 

這裏能夠用下載的ippicvlinux20141027.tgz放進~/opencv/3rdparty/ippicv/downloads/linux-8b449a536a2157bcad08a2b9f266828b/ (cmake以前沒這個文件夾,camke的時候會執行下載,20+mb,網速快就不用管了)spa

cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local  
#make -j 後面的數字是並行個數,cpu厲害就設大點。通常是用4 
make -j7  
sudo make install  

 

CuDNN

解壓cudnn的包(官網得申請,用網盤搜索能找到最新的),有include和lib64,裏面文件複製到對應/usr/local/cuda/對應文件夾裏code

#進到對應文件夾
sudo cp cudnn.h /usr/local/cuda/include/  
#進到對應文件夾
sudo cp lib* /usr/local/cuda/lib64/  
#可能要再進行一次 sudo ldconfig -v

 

不知道這裏會不會有文件權限問題,暴力搞一下(這條可先不用)

sudo chmod 777 -R /usr/local/cuda/lib64  

 

Caffe

git clone https://github.com/BVLC/caffe.git  
cp Makefile.config.example Makefile.config  

 

修改Makefile.config,去掉cudnn的註釋,其餘的在當前應用場景可不變。

make all  
make test  
make runtest  

 

OK了。

相關文章
相關標籤/搜索