Virtual Machine Ubuntu16,caffe Environment building

Source: Internet
Author: User
Tags gfortran

Ubuntu16.04+caffe+onlycup under a virtual machine

The official website step is very important, must follow the official website, the step to: http://caffe.berkeleyvision.org/installation.html

Then control: http://blog.csdn.net/firethelife/article/details/51926754

====================== "About attention and error" ===================

-------------------------------------------------------------------------------------

Caffe under make when you encounter some can not find ldhf5 such errors, then to install the LIBHDF5, the following resolution:

sudo apt-get install Libhdf5-dev

-------------------------------------------------------------------------------------

"Http://www.linuxidc.com/Linux/2016-07/132860.htm"

First install the necessary libraries, some rely on the library I have been installed, the specific installation of the relationship has been forgotten. If some dependencies do not meet the error, you can install the library again:

$ sudo apt-get install build-essential cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev    # 必要的基本库

Download the OpenCV3.1.0 version according to the link above and unzip it and then go to the installation file directory:

$ cd opencv-3.1.0$ mkdir build          #创建build文件夹$ cd opencv-3.1.0/build$ cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local ..  

----------------------------------------------------------------------------------

Openblas:

The default directory Is/opt/openblas/* This is the path to install */

$ git clone https://github.com/xianyi/OpenBLAS.git

"Http://www.linuxdiyf.com/linux/15610.html"

You will need to install the following steps:

(1) Git clone https://github.com/xianyi/OpenBLAS.git

(2) CD Openblas

(3) Make Fc=gfortran (if Gfortran is not installed, execute sudo apt-get install Gfortran)

(4) make install (install Openblas to/opt)

After installation, the corresponding CaffeMakefile.config修改如下:

# BLAS Choice:
# Atlas for Atlas (default)
# MKL for MKL
# Open for Openblas
BLAS: = Open
# Custom (Mkl/atlas/openblas) include and Lib directories.
# Leave commented to accept the defaults for your choice of BLAS
# (which should work)!
Blas_include: =/opt/openblas/include
Blas_lib: =/opt/openblas/lib

-----------------------------------------------------------------------------------

Some errors will occur when Caffe,,,make, check Caffe under Makefile.config, modify:

# Whatever Else you find your need goes here.
Include_dirs: = $ (python_include)/usr/local/include/usr/include/hdf5/serial/
Library_dirs: = $ (python_lib)/usr/local/lib/usr/lib/usr/lib/x86_64-linux-gnu/hdf5/serial/

Where:/usr/include/hdf5/serial/is the location of HDF5.

---------------------------------------------------------------------------------------

"Http://blog.csdn.net/lanxuecc/article/details/51997919"

Runtest will report a mistake:: Build_release/tools/caffe:error while loading shared libraries:libopenblas.so.0:cannot open shared Object File:no such file or directory, workaround: Create a soft link under/usr/lib/to point libopenblas.so.0 to the/openbls installation directory/lib/libopenblas.so.0

-----\

Create a soft link under/usr/lib/to point libopenblas.so.0 to the/openbls installation directory/lib/libopenblas.so.0
Ln-s/opt/openblas/lib/libopenblas.so.0/usr/lib/libopenblas.so.0

------------------------------------------------------------------------------------

============= Caffe under Makefile.config最终的样子如下 ==================

# # 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 (only if necessary)
#You should not set this flag if you'll be a reading Lmdbs with any
#possibility of simultaneous read and write
# Allow_lmdb_nolock: = 1

# Uncomment if you ' re using OpenCV 3
Opencv_version: = 3

# to customize your choice of compiler, uncomment and set the following.
# N.B. The default for Linux are g++ and the default for OSX is clang++
# Custom_cxx: = g++

# CUDA directory contains Bin/and lib/directories that we need.
Cuda_dir: =/usr/local/cuda
# on Ubuntu 14.04, if Cuda tools is installed via
# "sudo apt-get install Nvidia-cuda-toolkit" then use this instead:
# Cuda_dir: =/usr

# CUDA Architecture setting:going with all of them.
# for CUDA < 6.0, comment the *_50 lines for compatibility.
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_50,code=compute_50

# BLAS Choice:
# Atlas for Atlas (default)
# MKL for MKL
# Open for Openblas
BLAS: = Open
# Custom (Mkl/atlas/openblas) include and Lib directories.
# Leave commented to accept the defaults for your choice of BLAS
# (which should work)!
Blas_include: =/opt/openblas/include
Blas_lib: =/opt/openblas/lib

# Homebrew puts Openblas in a directory that's not on the standard search path
# Blas_include: = $ (Shell brew--prefix Openblas)/include
# Blas_lib: = $ (Shell brew--prefix Openblas)/lib

# This is required only if you'll compile the Matlab interface.
# MATLAB directory should contain the MEX binary In/bin.
# Matlab_dir: =/usr/local
# Matlab_dir: =/applications/matlab_r2012b.app

# Note:this is required only if you'll compile the Python interface.
# We need to is able to find Python.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)/anaconda2
Python_include: = $ (anaconda_home)/include \
$ (anaconda_home)/include/python2.7 \
$ (anaconda_home)/lib/python2.7/site-packages/numpy/core/include \

# Uncomment to use Python 3 (default is Python 2)
# python_libraries: = Boost_python3 python3.5m
# python_include: =/usr/include/python3.5m \
#/usr/lib/python3.5/dist-packages/numpy/core/include

# We need to is able to find libpythonx.x.so or. dylib.
Python_lib: =/usr/lib
#PYTHON_LIB: = $ (anaconda_home)/lib

# Homebrew installs NumPy in a 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 written in Python (would link against Python libs)
# With_python_layer: = 1

# Whatever Else you find your need goes here.
Include_dirs: = $ (python_include)/usr/local/include/usr/include/hdf5/serial/
Library_dirs: = $ (python_lib)/usr/local/lib/usr/lib/usr/lib/x86_64-linux-gnu/hdf5/serial/

# If Homebrew is installed at a non standard location (for example your home directory) and you use it for general Depende Ncies
# Include_dirs + = $ (Shell brew--prefix)/include
# Library_dirs + = $ (Shell brew--prefix)/lib

# Uncomment to the use of ' pkg-config ' to specify OpenCV library paths.
# (usually not necessary--OpenCV libraries is normally installed in one of the above $LIBRARY _dirs.)
# Use_pkg_config: = 1

# n.b. Both build and distribute dirs is cleared on ' make clean '
Build_dir: = Build
Distribute_dir: = Distribute

# Uncomment for debugging. Does not work on OS X due to https://github.com/BVLC/caffe/issues/171
# DEBUG: = 1

# The ID of the GPU that's ' make runtest ' would use to run unit tests.
Test_gpuid: = 0

# Enable pretty build (comment to see full commands)
Q? = @

-----------------------------------------------------------------------------------------------

Impression: In Windows and virtual machine Ubuntu16 under the environment, so I want to shout: Ghosts know what I have experienced this four days .... Fortunately you did not give up!!!

It took 2 days to understand: Cuda is Nvidia's graphics card, and my machine is "computer right button-Properties-adapter-(the last item) display adapter: AMD" AMD, so the Cuda into the Ubuntu not to go to the GUI, here to open a variety of heavy installation bumpy road .... It's been a two-day conversation. Oh my god!!! Fortunately, insisted on down!! :) Come on.

Virtual Machine Ubuntu16,caffe Environment building

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.