ϸ Centos 6.5 ϵͳ°װ caffe v2.0 ϸ裬ҽ CPU GPU IJԡ

 

    װ caffe cudnn v3 ٴα룬½ GPU IJԡ

 

    װ CUDA 汾 7.5װĬ nvidia Կ 352.39װ /usr/local/cudaĿ¼£Ѿȷװ freeglut

 

    װ CUDAɲο¡ְֽװ CUDACentos6.5

 

    root û caffe ı밲װ /root ½ caffe Ŀ¼ΪĿ¼


 

caffe װ裺

 


1. װ atlassnappyopencvʹ yum install ʽ

 

    # cd ~/caffe


    # yum install atlas-devel


    # yum install snappy-devel


    # yum install opencv-devel

 

2. װ boostʹõİ汾 1.60 boost_1_60_0.tar.gz Ŀ¼£

 

   # tar xvf boost_1_60_0.tar.gz


   # cd boost_1_60_0


   # ./bootstrap.sh


   # ./b2


   # ./b2 install

 

    boost ڱ caffe v1.0 ʱҲDz yum install ʽDZ caffe v2.0 ʱ⣨ 11 make all ʱʾϢͼԸΪԴ boost

 


 

3. װ protobufʹõİ汾 2.5.0 protobuf-2.5.0.tar.gz Ŀ¼¡ /opt ½ protobuf Ŀ¼

 

    # cd ~/caffe


    # tar Cxvf protobuf-2.5.0.tar.gz


    # cd protobuf-2.5.0


    # ./configure --prefix=/opt/protobuf


        protobuf Ҫװ /opt/protobuf £ prefix ָĿ¼


    # make


    # make install


        ʱ /opt/protobuf Ŀ¼ bininclude lib Ŀ¼

 

4. װ leveldbʹõİ汾 1.7.0 leveldb.1.7.0.tar.gz Ŀ¼¡

 

    # cd ~/caffe


    # tar Cxvf leveldb-1.7.0.tar.gz


    # cd leveldb-1.7.0


    # make


        libleveldb.a


    # cp libleveldb.so.1.7 /usr/lib/.


    # cp libleveldb.a /usr/lib/.


        ӦļϵͳļĿ¼¡


    # cp Cr include/leveldb /usr/local/include


        ӦͷļϵͳͷļĿ¼¡

 

5. װ hdf5ʹõİ汾 1.8.8 hdf5-1.8.8.tar.gz Ŀ¼¡ /opt ½ hdf5 Ŀ¼

 

    # cd ~/caffe


    # tar Cxvf hdf5-1.8.8.tar.gz


    # cd hdf5-1.8.8


    # ./configure --prefix=/opt/hdf5


        hdf5 Ҫװ /opt/hdf5 £ prefix ָĿ¼


    # make


    # make install


        ʱ /opt/hdf5 Ŀ¼ binincludelib share ĸĿ¼

 

6. װ glogʹõİ汾 0.3.3 glog-0.3.3.tar.gz Ŀ¼¡

 

    # cd ~/caffe


    # tar Cxvf glog-0.3.3.tar.gz


    # cd glog-0.3.3


    # ./configure


    # make


    # make install

 

    ע make make install ʱʱӰյı룬Ϊõ libglog.so libglog.a ѹ .lib Ŀ¼дڣ glog Ҫдʱ logյıӰ첻

 

7. װ gflags master.zip Ŀ¼¡

 

    # cd ~/caffe


    # unzip master.zip


    # cd gflags-master


    # mkdir build


    # cd build


    # export CXXFLAGS=-fPIC


    # cmake ..


    # make VERBOSE=1


    # make


    # make install

 

8. װ lmdb

 

    lmdb yum ʽװǣ

 

    # yum install lmdb-devel

 

    ʱ yum װcaffe ʱҲ lmdb.hԻǽҲµİװʽ

 

    /usr/local Ŀ¼½Ŀ¼ manȻĿ¼½ man1 Ŀ¼ʱ

 

    # cd /usr/local


    # mkdir man


    # cd man


    # mkdir man1

 

    # cd ~/caffe


    # git clone git://gitorious.org/mdb/mdb.git


    # cd mdb/libraries/liblmdb


    # make

    # make install

 

9. caffe İװҪװ opencvGithub ѾдİװűűʱȷִУֹ OpenCV opencv-3.0.0-rc1.zip Ŀ¼£

 

    # cd ~/caffe


    # unzip opencv-3.0.0-rc1.zip

    # cd opencv-3.0.0-rc1


    # sed  -i '/string(MD5/d' cmake/cl2cpp.cmake


    # mkdir build


    # cd build


    # cmake -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_INSTALL_PREFIX=/usr/local ..


    # make


    # make install

 

10. ޸ ~/.bashrcļû


    # vi ~/.bashrc

 

    /opt/protobuf/bin 뵽 PATH Уݣ

 

    export PATH=$PATH:/opt/protobuf/bin

 

    ˳

 

    ˳ն˴ڣһն˴ʹЧ

 

11. װ caffe caffe-master.zip Ŀ¼¡

 

    # cd ~/caffe


    # unzip caffe-master.zip


    # cd caffe-master

    # cp Makefile.config.example Makefile.config


    # vi Makefile

 

    ޸Ϊ

 

    COMMON_FLAGS CI/opt/protobuf/include CI/opt/hdf5/include

    DFLAGS CL/opt/protobuff/lib CL/opt/hdf5/lib CL/usr/lib

 

    # vi Makefile.config

 

    ޸Ϊ


    LIBRARY_DIRS /usr/lib64/atlas

 

    # make all

 

12. л

 

    caffe ʱҪ protobuf hdf5 Ŀ⣬ /etc/ld.so.conf.d Ŀ¼½һ caffe.conf ļҪõĿĿ¼д롣

 

    # vi /etc/ld.so.conf.d/caffe.conf

 

   

 

     /opt/protobuf/lib


     /opt/hdf5/lib

 

    ˳

 

    # ldconfig

 

13. С

 

    # cd ~/caffe/caffe-master


    # sh data/mnist/get_mnist.sh


    # sh examples/mnist/create_mnist.sh

 

    ~/caffe/caffe-master/examples/mnist/lenet_solver.prototxt ļָ CPU 汾 GPU 汾

 

    # vi examples/ mnist/lenet_solver.prototxt

 

     ޸һУ solver_mode: CPU solver_mode: GPU

 

    # sh examples/mnist/train_lenet.sh

 

caffe cudnn װ裺

 


1.  cudnn-7.0-linux-x64-v3.0-rc.tgz Ŀ¼¡

 

    # cd ~/caffe


    # tar xvf cudnn-7.0-linux-x64-v3.0-rc.tgz

 

    # cd cuda


    # cp *.h /usr/local/include/.


        ͷļϵͳͷļĿ¼¡


    # cp lib* /usr/local/lib/.


        ļϵͳļĿ¼¡


   # ldconfig

 

2. ǽղűõ caffe-master Ŀ¼Ϊ caffe-gpuȻ cudnn 汾 caffe caffe װIJ 11 ͬ Makefile.config USE_CUDNN еעȥȻб롣

 

    # cd ~/caffe


    # mv caffe-master caffe-gpu


    # unzip caffe-master.zip


    # cd caffe-master


    # cp Makefile.config.example Makefile.config


    # vi Makefile

 

    ޸Ϊ


    COMMON_FLAGS CI/opt/protobuf/include CI/opt/hdf5/include


    LDFLAGS CL/opt/protobuff/lib CL/opt/hdf5/lib CL/usr/lib

 

    # vi Makefile.config

 

    ޸Ϊ

    USE_CUDNN еעȥ USE_CUDNN := 1


    LIBRARY_DIRS /usr/lib64/atlas

 

    # make all

 

3. caffe cudnn caffe װIJ 13 ͬ


 

 

Ͷתע


 
ƪ˵òĵطϵǣ


 
1  ϵ߿ͷʱͨ

2  400-810-0205


3  վԣⲢϵʽ