Task: install Caffe framework on Ubuntu 15.04 with CUDA 7.5
Link to Kubuntu 15.04: kubuntu-15.04-desktop-amd64.iso
Link to CUDA 7.5: Download (1.1 GB)
Update the system
- Install build essentials:
sudo apt-get install build-essential
- Install latest version of kernel headers:
sudo apt-get install linux-headers-`uname -r`
Install CUDA
- Install curl (for the CUDA download):
sudo apt-get install curl
- Download CUDA 7.5 to Downloads folder
- cd Downloads
- Download cuda_7.5.18_linux.run from https://developer.nvidia.com/cuda-downloads
- Make the downloaded installer file runnable:
chmod +x cuda_7.5.18_linux.run
- Run the CUDA installer:
sudo ./cuda_7.5.18_linux.run --kernel-source-path=/usr/src/linux-headers-`uname -r`/
- Accept the EULA
- Do NOT install the graphics card drivers (since we are in a virtual machine)
- Install the toolkit (leave path at default)
- Install symbolic link
- Install samples (leave path at default)
- Update the library path
echo 'export PATH=/usr/local/cuda/bin:$PATH' >> ~/.bashrc
echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/lib64:/usr/local/lib' >> ~/.bashrc
source ~/.bashrc
Install dependencies
sudo apt-get install -y libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libboost-all-dev libhdf5-serial-dev protobuf-compiler gfortran libjpeg62 libfreeimage-dev libatlas-base-dev git python-dev python-pip libgoogle-glog-dev libbz2-dev libxml2-dev libxslt-dev libffi-dev libssl-dev libgflags-dev liblmdb-dev python-yaml
sudo easy_install pillow
Install Caffe
- Download Caffe:
cd ~
git clone https://github.com/BVLC/caffe.git
- Install python dependencies for Caffe:
cd caffe
cat python/requirements.txt | xargs -L 1 sudo pip install
- Add a couple of symbolic links for some reason:
sudo ln -s /usr/include/python2.7/ /usr/local/include/python2.7
sudo ln -s /usr/local/lib/python2.7/dist-packages/numpy/core/include/numpy/ /usr/local/include/python2.7/numpy
- Create a
Makefile.config
from the example:cp Makefile.config.example Makefile.config
Edit Makefile.config
- Uncomment the line
# CPU_ONLY := 1
(In a virtual machine we do not have access to the the GPU) - Under
PYTHON_INCLUDE
, replace/usr/lib/python2.7/dist-packages/numpy/core/include
with/usr/local/lib/python2.7/dist-packages/numpy/core/include
(i.e. add/local
) - Add reference to hdf5
INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include /usr/lib/x86_64-linux-gnu/hdf5/serial/include
LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib /usr/lib/x86_64-linux-gnu/hdf5/serial
- Uncomment the line
- Add “opencv_imgcodecs” to the Makefile.
- (LIBRARIES += glog gflags protobuf leveldb snappy \
lmdb boost_system hdf5_hl hdf5 m \
opencv_core opencv_highgui opencv_imgproc opencv_imgcodecs)
- (LIBRARIES += glog gflags protobuf leveldb snappy \
- Compile Caffe:
make pycaffe
make all
make test
Congralutations!!! You have successfully installed Caffe into Ubuntu 15.04 with CUDA 7.5. Let’s enjoy it now.
You can play with it in python. But I prefer ipython notebook since it allows us to debug to have a deep insight into what happens in the code, not just a black box.
( In case ipython notebook runs into error, please run
For 4.0 and above You need to install the notebook app separately from https://github.com/jupyter/notebook
pip install jupyter
)
-------------------------
CAFFE on Ubuntu 16.04 CUDA8 OpenCV3.1
https://github.com/BVLC/caffe/wiki/Ubuntu-16.04-or-15.10-Installation-Guide
https://github.com/BVLC/caffe/wiki/Ubuntu-16.04-or-15.10-OpenCV-3.1-Installation-Guide
If there is error with #error -- unsupported GNU version! gcc versions later than 5.3 are not supported!
then the solution here:
https://github.com/BVLC/caffe/wiki/GeForce-GTX-1080,—CUDA-8.0,—Ubuntu-16.04,—Caffe
If there is error with graph cut then solution here:
http://answers.opencv.org/question/95148/cudalegacy-not-compile-nppigraphcut-missing/
[…] Source: Caffe installation guide […]
LikeLike
[…] https://kiennguyenstuff.wordpress.com/2015/10/07/caffe-installation-guide/ […]
LikeLike