Friday, April 10, 2015

Install caffe on ubuntu 14.04

Install cuda first, I am using 7.5

Install cuDNN

Go to https://developer.nvidia.com/cuDNN, download .tar.gz file and extract.
Here is the link for cuDNN v3 lib for linux.
wget -c http://developer.download.nvidia.com/assets/cuda/secure/cuDNN/v3/cudnn-7.0-linux-x64-v3.0-prod.tgz?autho=1445140377_f51da7032f9f7293550d875fc2b8c4ef&file=cudnn-7.0-linux-x64-v3.0-prod.tgz

v5 link:


Copy all the files, (except cudnn.h) to /usr/local/cuda-6.5/lib64

Copy the cudnn.h to /usr/local/cuda-6.5/include

Install cuda sdk
use the following example command (modify accordingly), the shell script is in bin dir of your cuda installation dir.
$cuda-install-samples-7.5.sh /home/xxxx/

Install opencv
http://rodrigoberriel.com/2014/10/installing-opencv-3-0-0-on-ubuntu-14-04/

you can donwload the opencv from the official website,
http://opencv.org/downloads.html

set cuda generation by auto
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_TBB=ON -D WITH_V4L=ON -D WITH_QT=ON -D WITH_OPENGL=ON -D CUDA_GENERATION=Auto ..

otherwise, you will see errors about gpu architecture 'compute_11'

refer to : https://help.ubuntu.com/community/OpenCV

install opencv 2.4.10

https://github.com/BVLC/caffe/wiki/Ubuntu-14.04-VirtualBox-VM



~/Downloads/opencv/opencv-3.0.0-alpha/modules/cudalegacy/src/cuda/NCVPixelOperations.hpp(51): error: a storage class is not allowed in an explicit specialization


if you are using opencv 3.0 alpha version, you may come across the errors below.
remove the static keyboard before the inline

do the same thing for
/home/leiming/Downloads/opencv/opencv-3.0.0-alpha/modules/cudastereo/src/cuda/stereocsbp.cu

line 62/66/74


/usr/include/opencv2/contrib/openfabmap.hpp:118:36: error: ‘vector’ does not name a type
put using namespace std before the included header files in openfabmap.hpp



Install caffe

Install all the dependencies and libraries needed for caffe in ubuntu
sudo apt-get install libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libboost-all-dev libhdf5-serial-dev
sudo apt-get install libgflags-dev libgoogle-glog-dev liblmdb-dev protobuf-compiler
sudo apt-get install libopenblas-dev
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
(installed libboost and libopenblas)

cp Makefile.config.example Makefile.config

In the Makefile.config, uncomment the "USE_CUDNN".
# cuDNN acceleration switch (uncomment to build with cuDNN).
# USE_CUDNN := 1

make -j $(nproc) all
make -j $(nproc) test 
make -j 8 runtest 
make pycaffe 
make distribute


/usr/bin/ld: cannot find -lcblas
/usr/bin/ld: cannot find -latlas

sudo apt-get install libatlas-base-dev
(http://caffe.berkeleyvision.org/install_apt.html)

make -j $(nproc) runtest


at last you should see your test passed!

Congratulations!


to test
build/tools/caffe time --model=models/bvlc_alexnet/deploy.prototxt --gpu=0


you can build pycaffe too.
(http://installing-caffe-the-right-way.wikidot.com/start)

To run caffe in eclipse, please refer to
http://tzutalin.blogspot.com/2015/05/caffe-on-ubuntu-eclipse-cc.html
http://tzutalin.blogspot.tw/2015/06/setup-caffe.html
You can build your caffe first, and add existing g++ project to eclipse, then configure the include, lib and preprocessor settings.


--------------------------------------------------------------------------------------------------------------------------
http://petewarden.com/2014/10/25/how-to-run-the-caffe-deep-learning-vision-library-on-nvidias-jetson-mobile-gpu-board/
http://corpocrat.com/2014/11/03/how-to-setup-caffe-to-run-deep-neural-network/

2 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. I like viewing web sites which comprehend the price of delivering the excellent useful resource free of charge. I truly adored reading your posting. Thank you! franchising caffe

    ReplyDelete