1. Overview

Caffe is a deep learning framework made with expression, speed, and modularity in mind.

Caffe는 표현, 속도 및 모듈성을 염두에 두고 만들어진 Deep Learning framework 입니다.

It is developed by Berkeley AI Research (BAIR) and by community contributors.

Yangqing Jia created the project during his PhD at UC Berkeley.

Caffe is released under the BSD 2-Clause license.

  1. Prerequisites

Execute these commands first:

sudo apt-get update

sudo apt-get upgrade

sudo apt-get install -y build-essential cmake git pkg-config

sudo apt-get install -y libprotobuf-dev libleveldb-dev libsnappy-dev \

                libhdf5-serial-dev protobuf-compiler libatlas-base-dev \

                libboost-all-dev libgflags-dev libgoogle-glog-dev liblmdb-dev

# (Python general)

sudo apt-get install -y python-pip

# (Python 2.7 development files)

sudo apt-get install -y python-dev

sudo apt-get install -y python-numpy python-scipy

# (or, Python 3.5 development files)

sudo apt-get install -y python3-dev

sudo apt-get install -y python3-numpy python3-scipy

# (OpenCV 2.4)

sudo apt-get install -y libopencv-dev

  1. the GPU Support Prerequisites

3.1 Installing cuda

3.2 Installing cudnn

3.3 Installing nccl (optional)

  • nccl install, if it is Multi-GPU support Machine.

  • Download Caffe latest source from git

cd ${HOME}

wget https://github.com/BVLC/caffe/archive/1.0.zip

sudo mv 1.0.zip /usr/local

  1. Unzip Caffe Zip file

cd /usr/local

sudo unzip 1.0.zip

ls -al

drwxr-xr-x 17 root root 4096 11월 30 22:42 caffe-1.0/

  1. point of modify

  2. /src/caffe/util/blocking_queue.cpp 수정

/src/caffe/util/blocking_queue.cpp. After the line 89, and the new line that contains the following:

template class BlockingQueue<Datum*>;

  • Copy the Makefile.config.example to Makefile.config

cd /usr/local/caffe-1.0

sudo cp Makefile.config.example Makefile.config

vi Makefile.config

USE_CUDNN := 1

The following line in the configuration file tells the program to use CPU only for the computations.

CPU_ONLY := 1

remove compute_20 architector in CUDA_ARCH

not supported in over cuda 9.0 version

CUDA_ARCH := -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

PYTHON_INCLUDE := /usr/include/python2.7 /usr/local/lib/python2.7/dist-packages/numpy/core/include

WITH_PYTHON_LAYER := 1

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 /usr/lib/x86_64-linux-gnu/hdf5/serial

USE_NCCL := 1

cd python

for req in $(cat requirements.txt); do sudo -H pip install $req --upgrade; done

cd ..

sudo vi Makefile

and replace this line:

NVCCFLAGS += -ccbin=$(CXX) -Xcompiler -fPIC $(COMMON_FLAGS)

with the following line

NVCCFLAGS += -D_FORCE_INLINES -ccbin=$(CXX) -Xcompiler -fPIC $(COMMON_FLAGS)

vi CMakeLists.txt

# ---[ Includes

set(${CMAKE_CXX_FLAGS} "-D_FORCE_INLINES ${CMAKE_CXX_FLAGS}")

sudo make all

sudo make test

sudo make runtest

sudo make pycaffe -should be finished already, so you can omit this one

sudo make distribute

sudo make all -j $(($(nproc) + 1))

빌드 프로세스는 위의 명령에 -j $ (($ (nproc) + 1))를 추가하여 속도를 높일 수 있습니다.

이 명령은 시스템의 사용 가능한 프로세서에 교차 빌드를 분배합니다.

In order to make the Python work with Caffe, open the file ~/.bashrc for editing

in your favorite text editor. There, add the following line at the end of file:

export PYTHONPATH=/usr/local/caffe-1.0/python:$PYTHONPATH

You can also execute that same line immediately in the terminal as a command

for immediate effects, or in general execute:

source ~/.bashrc

results matching ""

    No results matching ""