Table of Content
- Content
{:toc}
Prerequisite
- install NVIDIA GTX970M driver
- install CUDA 7.0 Toolkit
Please refer to my previous blog Installation of NVIDIA GPU Driver and CUDA Toolkit
Install OpenBLAS
- download source code from OpenBLAS official website and extract the archive
- (optional) install gfortran by
sudo apt-get install gfortran
- change directory to the position of extracted folder the and compile
make FC=gfortran
- install by
make PREFIX=/your/path install
- add paths to envrionment:
PATH=/your/path/to/openblas/include:$PATH
andLD_LIBRARY_PATH=/your/path/to/openblas/lib:$LD_LIBRARY_PATH
and export the pathes.
Install Anaconda
- download the script from http://continuum.io/downloads
- change mode
sudo chmod +x Anaconda*.sh
- execute the installer by
bash Anaconda*.sh
- in ~/.bashrc add
1 | LD_LIBRARY_PATH=your_anaconda_path/lib:$LD_LIBRARY_PATH |
NEVER put it in /etc !!! Otherwise, one may be in danger of unable to get into GUI.
- config HDF5 version
1 | cd /usr/lib/x86_64-linux-gnu |
Install OpenCV
One can conveniently install OpenCV by run a shell script from a Github repository
- download the script. For me, I use OpenCV 2.4.10.
- change mode of the shell
sudo chmod +x opencv2_4_10.sh
- run the script
sudo ./opencv2_4_10.sh
. Note that one may need to modify the cmake settings, such as eliminating QT.
Install a Set of Dpendencies
Following the guideline in Caffe, we can set up the dependencies by commond sudo apt-get install libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libboost-all-dev libhdf5-serial-dev libgflags-dev libgoogle-glog-dev liblmdb-dev protobuf-compiler
Compile Caffe
- get Caffe from github
git clone https://github.com/BVLC/caffe.git
- edit Makefile.config to set correct paths. Firstly create Makefile.config by
cp Makefile.config.example Makefile.config
. Then modify several paths. For me, I set blas to openblas and set blas path to /opt/OpenBLAS/include and /opt/OpenBLAS/lib where I install OpenBLAS; Python is set to Anaconda as well as its paths. - compile Caffe by
make -j
andmake pycaffe
- In addition, so far Caffe should be able to be compiled without any problem. However, when running exampls such as MNIST, some libs might be missing. My solution is to add libraries to the system library cache. For example, create a file called cuda.conf in /etc/ld.so.conf.d/ and add the path “/usr/local/cuda-7.0/lib64” to this file.