"Caffe" Ubuntu installation Caffe GPU version

Source: Internet
Author: User
Tags git clone

Installation environment: Ubuntu 16.04lts 64-bit, gcc5.4 gpu1080ti,cuda8.0,cudnn5.1.10

1. Installing dependent libraries
sudo apt-get install Libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libhdf5-serial-dev Libboost-all-dev Protobuf-compilersudo apt-get Install Libatlas-base-dev libgflags-dev libgoogle-glog-dev Liblmdb-dev
2. Installing Caffe

Terminal Input Command:

git clone git://github.com/bvlc/caffe.git

Then find the Caffe folder, open and you will find the Makefile.config.example file,

This time the Makefile.config.example copy is named Makefile.config and opened, which will

#USE_CUDNN: = # Cuda_dir: =/usr/local/cuda# 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

Remove the comment # and replace the Cuda_dir with your Cuda installation path

Open a Makefile.config file and

Add to

Open a makefile file to find

LIBRARIES +=glog gflags protobuf boost_system boost_filesystem m HDF5_HL hdf5

Change to:

LIBRARIES +=glog gflags protobuf boost_system boost_filesystem m HDF5_SERIAL_HL hdf5_serial

After execution

Make Allmake Testmake runtest

If the error occurs during the compilation process, you can find the missing file path.

For example, FAQs:

./include/caffe/util/hdf5.hpp:6:18:fatal error:hdf5.h:no such file or directory

Workaround: Locate the file path:

sudo find/-name hdf5.h

Locate the corresponding file path and add it to makefile.config.

The query results are:

/usr/include/hdf5/serial/hdf5.h

Open Makefile.config, in

After adding

Note the path, with Include_dirs and Library_dirs two, see if the path to the lost file is in/usr/include or/usr/lib

Under normal circumstances should be no problem.

3. Install anaconda, configure the Python Caffe interface

1. Install Anaconda, select Python2.7 Note file name

Bash anaconda2-4.3.0-linux-x86_64.sh

2. During the installation process notice, do not always enter, remember to always choose the default on the line, fool-type installation, and then will be prompted to add a path in the BASHRC document, select "Yes" here

3. Open the BASHRC document, under Home, open the Show hidden files option to find the file. Add in the last line

Export path=/home/(your username)/anaconda2/bin: $PATH (depending on your installation path) export pythonpath=/home/(your user name)/caffe/python:$ PYTHONPATH (IBID.) export ld_preload=/usr/lib/x86_64-linux-gnu/libstdc++.so.6

BASHRC document changes, you need to source a bit, or log off/restart your computer:

4. Modify the Makefile.config document under Caffe

#ANACONDA_HOME: = $ (HOME)/anaconda2#python_include: = $ (anaconda_home)/include  #$ (anaconda_home)/include/ python2.7   #$ (anaconda_home)/lib/python2.7/site-packages/numpy/core/include#python_lib: = $ (anaconda_home)/ Lib#with_python_layer: = 1

Remove the comment # to

Python_lib: =/usr/lib

Add a comment.

5. Upgrading the GCC version in Anaconda

Conda Update

Or

Conda  Install LIBGCC

Upgrade confirmation prompt, enter Y, after successful upgrade, turn off the terminal to reopen

6. Go back to the Caffe directory and compile

Make Allmake Pycaffe

After success, enter Python, then enter

Import Caffe

An error message appears:

No module named Google.protobuf

The command is now entered

Conda Install Protobuf

After the end and then re-import Caffe, successful words should not have any hint.

4. Testing

Enter the Caffe installation directory

./data/mnist/get_mnist.sh./examples/mnist/create_mnist.sh./examples/mnist/train_lenet.sh

The success of the words so long can end the installation!

"Caffe" Ubuntu installation Caffe GPU version

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.