"21 Days Combat Caffe" study notes (i) Ubuntu16.04+caffe environment construction

Source: Internet
Author: User
Tags git clone

  1. Pre-Installation Preparation work:
    sudo Install libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libhdf5-serial-dev protobuf-Compiler  sudoinstall --no-install-recommends libboost-all-devsudo  Install libatlas-base-devsudoinstall the python-devsudo Install Libgflags-dev libgoogle-glog-dev Liblmdb-dev

  2. "Optional" Installation Cuda and anaconda, see Ubuntu16.04+theano Environment in detail
  3. Download Caffe:
    git clone https://github.com/bvlc/caffe.git

  4. To modify a configuration file:
    CD caffe/CP Makefile.config.example makefile.config

  5. Modify various paths in the configuration file
    Vim Makefile.config.

    The configuration file I configured is:

    # # Refer to http://caffe.berkeleyvision.org/installation.html# Contributions simplifying and improving our build system is welcome!# CuDNN Acceleration switch (uncomment to build with CuDNN). USE_CUDNN:=1# CPU-Only switch (uncomment to build without GPU support). # Cpu_only:=1# Uncomment to disable IO dependencies and corresponding data layers# USE_OPENCV:=0# Use_leveldb:=0# Use_lmdb:=0# Uncomment to allow Mdb_nolock when reading LMDB files ( onlyifnecessary) # You should no set this flagifYou'll be reading Lmdbs with any# possibility of simultaneous read andWrite# Allow_lmdb_nolock:=1# UncommentifYou're using OpenCV 3# opencv_version: =3# To customize your choice of compiler, uncomment and set the following.# n.b. The default forLinux is g++ and the default forOSX is clang++# Custom_cxx:= g++# CUDA directory contains bin/And lib/directories that we need. Cuda_dir:=/usr/local/cuda# on Ubuntu14.04,ifCuda Tools is installed via#"sudo apt-get install Nvidia-cuda-toolkit"  ThenUse this instead:# cuda_dir:= /usr# cuda Architecture setting:going with all of them.# for CUDA<6.0, comment The *_50 through *_61 lines forcompatibility.# for CUDA<8.0, comment The *_60 and *_61 lines forcompatibility. Cuda_arch:=-gencode arch=compute_20,code=sm_20-gencode arch=compute_20,code=sm_21-gencode arch=compute_30,code=sm_30-gencode arch=compute_35,code=sm_35-gencode arch=compute_50,code=sm_50-gencode arch=compute_52,code=sm_52-gencode arch=compute_60,code=sm_60-gencode arch=compute_61,code=sm_61-gencode arch=compute_61,code=compute_61# BLAS choice:# Atlas forATLAS (default) # MKL formkl# Open forOpenblasblas:=atlas# Custom (MKL/atlas/Openblas) include and Lib directories.# Leave commented to accept the defaults forYour choice of blas# (whichshould work)!# Blas_include:=/path/to/your/blas# blas_lib:=/path/to/your/blas# Homebrew puts OpenblasinchA directory that's not on the standard search path# blas_include:= $ (Shell brew--prefix openblas)/include# blas_lib:= $ (Shell brew--prefix openblas)/lib# This was required onlyifYou'll compile the matlab interface.# matlab directory should contain the MEX binaryinch/bin.# Matlab_dir:=/usr/local# Matlab_dir:=/applications/matlab_r2012b.app# Note:this is required onlyifYou'll compile the Python interface.# We need to being able toFindPython.h and numpy/Arrayobject.h.python_include:=/usr/include/python2.7                 /usr/lib/python2.7/dist-packages/numpy/core/include# Anaconda Python distribution is quite popular. Include path:# Verify Anaconda location, sometimes it's in root.Anaconda_home: = $ (HOME)/Anaconda2python_include:= $ (anaconda_home)/include $ (anaconda_home)/include/python2.7$ (anaconda_home)/lib/python2.7/site-packages/numpy/core/include# Uncomment to use Python3(Default is Python2) # Python_libraries:=boost_python3 python3.5m# python_include:=/usr/include/Python3.5m #/usr/lib/python3.5/dist-packages/numpy/core/include# We need to being able toFindlibpythonx.x.so or. Dylib. Python_lib:=/usr/lib# python_lib:= $ (anaconda_home)/lib# Homebrew installs NumPyincha non standard path (keg only) # Python_include+= $(dir$ (Shell python-c'import numpy.core; print (numpy.core.__file__)'))/include# Python_lib+ = $ (Shell brew--prefix numpy)/lib# uncomment to support layers writteninchpython (would link against Python libs) # With_python_layer:=1# WhateverElseYouFindYou need goes. Include_dirs:= $ (python_include)/usr/local/include/usr/include/hdf5/Seriallibrary_dirs:= $ (python_lib)/usr/local/lib/usr/lib/usr/lib/x86_64-linux-gnu/hdf5/serial# If Homebrew is installed at a non forExample your home directory) and use it forGeneral dependencies# Include_dirs+ = $ (Shell brew--prefix)/include# Library_dirs+ = $ (Shell brew--prefix)/lib# NCCL acceleration switch (uncomment to build with NCCL) # https://GITHUB.COM/NVIDIA/NCCL (last tested version:v1.2.3-1+cuda8.0)# USE_NCCL: =1# Uncomment to use 'Pkg-config' to specify OpenCV library paths.# (usually not necessary--OpenCV libraries is normally installedinchOne of the above $LIBRARY _dirs.) # Use_pkg_config:=1# n.b. Both build and distribute dirs is cleared on ' MakeClean ' Build_dir:=Builddistribute_dir:=distribute# Uncomment forDebugging. Does not work on OS X due to https://github.com/bvlc/caffe/issues/171# DEBUG: =1# The ID of the GPU that'Make runtest'Would use the to run unit tests. Test_gpuid:=0# Enable pretty build (comment to see full commands) Q?= @

  6. "Note" Do not copy and paste directly (user name is not correct), note that add hdf5 about the path, no cuda need to put cpu_only: = 1 before the # number removed, install Anaconda users Note that its file name is ~/anaconda2
  7. Compile:
     Make  All  Make Test  make Runtest

  8. Success without error

"21 Days Combat Caffe" study notes (i) Ubuntu16.04+caffe environment construction

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.