Author: Zongwei Zhou | 周纵苇
Weibo: @MrGiovanni
Email: zongweiz@asu.edu
Overview
- System: Ubuntu 16.04 LTS
- Graphics: GeForce GTX 960M/PCIe/SSE2
- OS type: 64-bit
- Python: 2.7.12
Downloads
- CUDA Linux x86_64 Ubuntu 16.04 deb(local) 1.9GB
cuda-repo-ubuntu1604-8-0-local_8.0.44-1_amd64.deb
- link - cuDNN log in for CUDA 8.0 cuDNN v5.1 Library for Linux
cudnn-8.0-linux-x64-v5.1.tgz
- link - caffe github clone or download
caffe-master.zip
- link
Install CUDA
Open Terminator
cd Downloads/
sudo dpkg -i cuda-repo-ubuntu1604-8-0-local_8.0.44-1_amd64.deb
sudo apt-get update
sudo apt-get install cuda
then restart ubuntu.
Install cuDNN
Open Terminator
cd Downloads/cuda/
sudo su
sudo cp -P include/cudnn.h /usr/include
sudo cp -P include/cudnn.h /usr/include
sudo cp -P include/cudnn.h /usr/include
Refer to How can I install CuDNN on Ubuntu 16.04?
Install caffe
Open Terminator
cd Downloads/caffe-master/
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
sudo apt-get install -y libatlas-base-dev
sudo apt-get install -y --no-install-recommends libboost-all-dev
sudo apt-get install -y libgflags-dev libgoogle-glog-dev liblmdb-dev
sudo apt-get install -y python-pip
sudo apt-get install -y python-dev
sudo apt-get install -y python-numpy python-scipy
sudo apt-get install -y libopencv-dev
cp Makefile.config.example Makefile.config
sudo apt-get install kate
kate ./Makefile.config &
Uncomment
USE_CUDNN := 1
WITH_PYTHON_LAYER := 1
Change
CUDA_DIR := /user/local/cuda-8.0
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
Open Terminator
cd Downloads/caffe-master/
find . -type f -exec sed -i -e 's^"hdf5.h"^"hdf5/serial/hdf5.h"^g' -e 's^"hdf5_hl.h"^"hdf5/serial/hdf5_hl.h"^g' '{}' \;
cd /usr/lib/x86_64-linux-gnu
sudo ln -s libhdf5_serial.so.10.1.0 libhdf5.so
sudo ln -s libhdf5_serial_hl.so.10.0.2 libhdf5_hl.so
cd Downloads/caffe-master/python
for req in $(cat requirements.txt); do pip install $req; done
cd ..
kate ./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)
Open Terminator
make all
make test
make runtest
make pycaffe
make distribute
gedit ~/.bashrc
add this line at the end of the file
export PYTHONPATH=/home/zongwei/Downloads/caffe-master/python:$PYTHONPATH
export PATH=$PATH:/home/zongwei/Downloads/caffe-master/build/tools
export PATH=$PATH:/home/zongwei/git/caffe/build/lib
export PATH=".:$PATH"
Open Terminator
caffe
done!
祝好!
Weibo: @MrGiovanni</font>