Install Caffe on CentOS 6.5

Check all path setting and configurations to see whether they are effective before compiling.

CUDA

  1. Add the card. 2 cables.
  2. Download and install Nvidia driver. Test with nvidia-smi
  3. Dowlaod and install CUDA tool kit, consist with the versioin of driver. Test with deviceQuery

Others

Try this first, if they are not properly installed, refer to tips below.
sudo yum install protobuf-devel leveldb-devel snappy-devel opencv-devel boost-devel hdf5-devel
sudo yum install gflags-devel glog-devel lmdb-devel

BLAS

sudo yum install blas-devel lapack-devel atlas-devel

BOOST

sudo yum install boost

Python

Caffe need Python>=2.7. But CentOS 6.5 used Python2.6 as default for core functions, such as yum.

Install Python 2.7 on CentOS 6

Then you have both python2.6 and python2.7. You have to specify python2.7 and pip2.7 in the command.

Change Caffe Makefile.configure file according to the new path to python2.7.

51 PYTHON_INCLUDE := /usr/local/lib/python2.7 \
52                 /usr/local/lib/python2.7/site-packages/numpy/core/include

openCV

Caffe need openCV>2.4, which can not be installed automatically by yum in CentOS 6.5.

Using whereis and locate to find out where Python2.7 is.

After download OpenCV 2.4 source file,

export PYTHON_EXECUTABLE=/usr/local/bin/python2.7
export PYTHON_INCLUDE_PATH=${PYTHON_EXECUTABLE%/*/*}/include/python2.7
export PYTHON_LIBRARY=${PYTHON_EXECUTABLE%/*/*}/lib/libpython2.7.a
export PYTHON_NUMPY_INCLUDE_DIR=${PYTHON_EXECUTABLE%/*/*}/lib/python2.7/site-packages/numpy/core/include/numpy
export PYTHON_PACKAGES_PATH=${PYTHON_EXECUTABLE%/*/*}/lib/python2.7/site-packages

cmake -D CUDA_GENERATION=Kepler -D PYTHON_EXECUTABLE=$PYTHON_EXECUTABLE  -D PYTHON_INCLUDE_PATH=$PYTHON_INCLUDE_PATH -D PYTHON_LIBRARY=$PYTHON_LIBRARY  -D PYTHON_NUMPY_INCLUDE_DIR=$PYTHON_NUMPY_INCLUDE_DIR  -D PYTHON_PACKAGES_PATH=$PYTHON_PACKAGES_PATH -D CMAKE_BUILD_TYPE=RELEASE ..

make -j 4
sudo make install

Several pits

nvcc fatal : Unsupported gpu architecture 'compute_11'

You should specify cmake -D CUDA_GENERATION=Kepler ..

/home/Simon/Work/dependence/opencv2.4/opencv-2.4.9/modules/gpu/src/nvidia/core/NCVPixelOperations.hpp(121): error: a storage class is not allowed in an explicit specialization

You should download a new file NCVPixelOperations.hpp to fix this bug.

If you find some bugs like Python.h: No such file., you should check the path settings above, making sure that they are effective.

link
link
link

Caffe Compile

cmake -D CUDA_GENERATION=Kepler -D PYTHON_EXECUTABLE=$PYTHON_EXECUTABLE  -D PYTHON_INCLUDE_PATH=$PYTHON_INCLUDE_PATH -D PYTHON_LIBRARY=$PYTHON_LIBRARY  -D PYTHON_NUMPY_INCLUDE_DIR=$PYTHON_NUMPY_INCLUDE_DIR  -D PYTHON_PACKAGES_PATH=$PYTHON_PACKAGES_PATH -D CMAKE_BUILD_TYPE=RELEASE ..

make -j 4
sudo make install

Mnist Example

According to tutorial, all should be done in $CAFFE_ROOT.

I try to manually compile the .cpp file, but encounter with include and link errors, such as file xx do not exist or undefined reference to xxx:xxxx. I try to fix them by using g++ -Ixxx/include -Lxxx/lib, but it is too complex, and confusing. After yum install and make install all these packages, how can I suppose to know where to find those header files, library files and links?

Makefile in $CAFFE_ROOT defined all those files needed for compilation.

Bugs log

/usr/bin/ld: cannot find -lboost_thread
collect2: ld returned 1 exit status
make: *** [.build_release/lib/libcaffe.so] Error 1

Solution

sudo ln -s /opt/maxcompiler-2014.1.1/lib/boost/lib/libboost_thread.so /usr/lib/libboost_thread.so

Or you could add atlas and boost to the link path LD_LIBRARY_PATH.

pycaffe

要根据实际情况(locate Python.h)修改python_include_path, 然后Make pyCaffe.

Model Training

1, No graceful way to exit, stop training with Ctrl-c. Need a tool for training curve plotting.
2, Saving snapshot for deploy and resuming training. But how?

Reference

  1. Caffe
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值