2016年5月8日 星期日

Debian install caffe

Caffe installation : Debian Sid / CPU ONLY
ref:
http://caffe.berkeleyvision.org/installation.html#compilation

#! /bin/bash
## install necessary packages
apt-get install build-essential libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libhdf5-serial-dev protobuf-compiler python-dev libgflags-dev libgoogle-glog-dev liblmdb-dev libatlas3-base libatlas-dev
apt-get install --no-install-recommends libboost-all-dev

## during compile stage , some  softlink were necessary under /usr/lib 
ln -s /usr/lib/atlas-base/libcblas.so.3  /usr/lib/libcblas.so
ln -s /usr/lib/atlas-base/libatlas.so.3  /usr/lib/libatlas.so

## git clone caffe source code
mkdir source; cd source ; git clone https://github.com/BVLC/caffe.git ; cd caffe;  cp Makefile.config.example Makefile.config

## modify Makefile.config
## CPU_ONLY
sed  -i '/CPU_ONLY/s/^#//g' Makefile.config 
echo 'INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include /usr/include/hdf5/serial/' >>Makefile.config
echo ''LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib /usr/lib/x86_64-linux-gnu/hdf5/serial/

## compile
make -j$(grep -c '^processor' /proc/cpuinfo) all
make -j$(grep -c '^processor' /proc/cpuinfo) test
make -j$(grep -c '^processor' /proc/cpuinfo) runtest






沒有留言: