caffe

Caffe安装

安装环境:RedHat7  
        NVIDIA M40

1.安装依赖:

yum install protobuf-devel leveldb-devel snappy-devel opencv-devel boost-devel hdf5 hdf5-devel

glog

git clone https://github.com/google/glog.git

mkdir build && cd build

export CXXFLAGS="-fPIC" && cmake .. && make VERBOSE=1 (需要cmake-3.0 later手动编译安装`./bootstrap --prefix=/usr;make;make install)

make install

glog-0.3.3需要automake-1.14,如果版本不足,需要手动源码安装(需安装autoconf,texinfo),并将glog中test-driver的链接地址修改为编译安装automake的地址,如/usr/local/share/automake-1.14/test-driver

gflags

yum install gflags gflags-devel,否则从源码编译:

git clone https://github.com/gflags/gflags.git

mkdir build && cd build && ccmake .. 按c配置,e忽略警告,按c直到g可用,按g

make && make install

参考gflags: Compiling the source code with CMake

lmdb

git clone https://github.com/LMDB/lmdb

cd libraries/liblmdb

make && make install

Dependencies

CUDA(参考本网站); BLAS yum install atlas-devel; Python yum install python-devel

Compile

git clone https://github.com/BVLC/caffe.git

cd caffe; cp Makefile.config.example Makefile.config

修改Makefile.config文件,例如使用cuDNN,PYTHON_INCLUDE包含numpy/arrayobject.h的路径,包含libpythonx.x.so的路径,测试GPU ID,使用Python layers等

开始编译:make all -j[pnums](make pycaffe; make test; make runtest)

遇到问题:

1、/usr/bin/ld: cannnot find -lcblas -latalas

修改Makefile文件第378行:

LIBRARIES += cblas atlas 为 LIBRARIES += satlas tatlas, 同时在Makefile.config配置BLAS的include,lib目录,如/usr/include/atlas和/usr/lib64/atlas