Caffe source install

If you use centos: try the command below, which can automatically install the requirements for caffe
author belong to wangfei@intel.
yum install epel-release
Note:
For make : PREFIX=/your/install/dir make install -n
For cmake: cmake -DCMAKE_INSTALL_PREFIX=/your/install/dir
Os: CentOS 7.2
To install of the software, please refer to the readme of corresponding github repo.

  1. Install cmake 3.6 from github
    git clone https://github.com/Kitware/CMake.git Cmake
    cd Cmake
    ./bootstrap –prefix=<intall_prefix> && make && make install

  2. Install opencv 2.4.13 from github
    git clone https://github.com/opencv/opencv.git Opencv
    cd Opencv
    mkdir release
    cd release
    cmake –D CMAKE_BUILD_TYPE=RELEASE –D CMAKE_INSTALL_PREFIX=/your/install/dir ..
    make && make install

  3. Install protobuf 2.7.0 from github
    git clone https://github.com/google/protobuf.git Protobuf
    cd Protobuf
    ./autogen.sh
    ./configure –prefix=<install_prefix>
    make
    make check
    make install
    cd python
    python setup.py build
    python setup.py install

  4. Install glog 0.3.4 from github
    git clone https://github.com/google/glog.git Glog
    cd Glog
    ./configure –prefix=<install_prefix>
    make && make install

  5. Install gflags2.1.2 from github
    git clone https://github.com/gflags/gflags.git Gflags
    cd Gflags
    mkdir build
    cd build
    cmake –D CMAKE_INSTALL_PREFIX=/your/install/dir ..
    make && make install

  6. Install lmdb 0.9 from github
    git clone https://github.com/LMDB/lmdb.git Lmdb
    cd Lmdb
    make
    PREFIX=/your/install/dir make install –n

  7. Install boost 1.61 from http://www.boost.org/users/history/version_1_61_0.html
    ./bootstrap.sh
    ./b2
    cp boost /usr/local/include
    cp stage/lib/* /usr/local/lib64

  8. Install zlib 1.2.5 from github
    git clone https://github.com/madler/zlib.git Zlib
    ./configure --prefix=<install_dir>
    make && make install

  9. Install snappy 1.1.3 from github
    git clone https://github.com/google/snappy.git Snappy
    cd Snappy
    ./autogen
    ./configure –prefix=<install_dir>
    make && make install

  10. Install leveldb 1.14 from github
    Git clone https://github.com/google/leveldb.git Leveldb
    cd Leveldb
    make
    PREFIX=/your/install/dir make install –n

  11. Install hdf5 (1.8.17for centos) from https://support.hdfgroup.org/downloads/index.html
    cp include/* <.h dir>
    cp lib/* <lib_dir>

  12. Add to ~./bashrc
    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib64

  13. Install intel-caffe and pycaffe
    cp Makefile.config.example Makefile.config
    uncomment CPU_ONLY and OPENCV_VERSION and ALLOW_LMDB_NOLOCK
    change the mkl dir and python dir to your own’s
    make
    make runtest
    make pycaffe

  14. export PYTHONPATH=/home/2T/intel-caffe/python:$PYTHONPATH
    Add to ~/.bashrc

!/bin/sh

source ~/.bashrc

source /home/xiaotian/tools/__release_lnx/mkl/bin/mklvars.sh intel64

KNL

export LD_LIBRARY_PATH=/usr/local/cuda/lib64:/home/xiaotian/boost_1_62_0/stage/lib:$LD_LIBRARY_PATH

export LIBS=" -L/home/xiaotian/tools/mkl-2017u2-1/__release_lnx/mkl/lib/intel64 -L/usr/local/cuda/lib64"

export CPPFLAGS="-I/home/xiaotian/tools/mkl-2017u2-1/__release_lnx/mkl/include -I/usr/local/cuda/include"

export LIBS="-L/home/xiaotian/boost_1_62_0/stage/lib -L/home/xiaotian/tools/mkl-2017u2-1/__release_lnx/mkl/lib/intel64 -L/usr/local/cuda/lib64"
export CPPFLAGS="-I/home/xiaotian/boost_1_62_0 -I/home/xiaotian/tools/mkl-2017u2-1/__release_lnx/mkl/include -I/usr/local/cuda/include"

export CPLUS_INCLUDE_PATH=/home/xiaotian/boost_1_62_0:$CPLUS_INCLUDE_PATH
make clean

make -j44
make py
ldd build/tools/caffe

原文地址:https://www.cnblogs.com/Viewsky/p/6714584.html