您的位置:首页 > Web前端

Set up Caffe on Ubuntu14.04 64bit+NVIDIA GTX970M+CUDA7.0

2015-08-30 15:12 387 查看

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
and
LD_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

LD_LIBRARY_PATH=your_anaconda_path/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH


NEVER put it in /etc !!! Otherwise, one may in danger of unable to get into GUI.

config HDF5 version

cd /usr/lib/x86_64-linux-gnu
sudo ln -s libhdf5.so.7 libhdf5.so.10
sudo ln -s libhdf5_hl.so.7 libhdf5_hl.so.10
sudo ldconfig


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[/code] 
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
and
make 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.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  ubuntu caffe