[2017-07-17] Install Caffe

July 17, 2017

Install Caffe on Ubuntu 16.04 + GTX1080 + CUDA8.0 + cuDNN5.1

Setup GPU environment

1. Install opencv for caffe

Install required packages

[compiler]
$ sudo apt-get install build-essential
[required]
$ sudo apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
[optional]
$ sudo apt-get install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev

Getting OpenCV source code

$ git clone https://github.com/opencv/opencv.git

Building OpenCV from source using cmake

$ cd opencv
$ mkdir build
$ cd build
$ cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local ..
$ make -j7
$ sudo make install

2. Install Caffe

Install required packages

$ sudo apt-get install libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libhdf5-serial-dev protobuf-compiler
$ sudo apt-get install --no-install-recommends libboost-all-dev
$ sudo apt-get install libgflags-dev libgoogle-glog-dev liblmdb-dev

Getting Caffe source code

$ git clone https://github.com/BVLC/caffe.git

Building Caffe from source with Make

$ cd caffe
$ cp Makefile.config.example Makefile.config
$ make all -j4
5분 내로 컴파일 됨. (su 풀었으면 앞에 make 앞에 sudo를 붙여줄 것)
$ make test -j4
$ make runtest

Building Caffe with CMake

$ mkdir build
$ cd build
$ cmake ..
$ make all
$ make install
$ make runtest

This post refers to:

  1. Ubuntu 16.04 Installation
  2. Installation
  3. 우분투-리눅스-설치-및-Caffe-설치


Profile picture

Written by Yerin Hong who lives in London and works in the UK.