Skip to content

Instantly share code, notes, and snippets.

@mitbal
Created July 11, 2016 04:31
Show Gist options
  • Save mitbal/965a69f19ade3fe42fd6b93229207425 to your computer and use it in GitHub Desktop.
Save mitbal/965a69f19ade3fe42fd6b93229207425 to your computer and use it in GitHub Desktop.
Caffe no GPU
# This file will try to install caffe deep learning framework, with cpu only mode
# Tested on Ubuntu 14.04
# Terminate on error
set -e
# Install general dependency
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
# Install CUDA & GPU driver
# skip
# Install BLAS
sudo apt-get install libatlas-base-dev
# (Optional) install python header
sudo apt-get install python-dev
# Remaining dependency (for ubuntu 14.04)
sudo apt-get install libgflags-dev libgoogle-glog-dev liblmdb-dev
# Clone the repository
git clone https://github.com/BVLC/caffe
# Set Makefile, to cpu only mode
cd caffe
line_cpu=`cat Makefile.config.example | grep -n 'CPU_ONLY' | cut -d: -f1`
head -n $((line_cpu-1)) Makefile.config.example > Makefile.config
echo 'CPU_ONLY := 1' >> Makefile.config
tail -n +$((line_cpu+1)) Makefile.config.example >> Makefile.config
# Compile time
make all
make test
make runtest
# To use python
cd ..
sudo apt-get install python-virtualenv
virtualenv CAFFE_PYTHON
source CAFFE_PYTHON/bin/activate
cd caffe/python
for req in $(cat requirements.txt); do pip install $req; done
cd ..
make pycaffe
export PYTHONPATH=`pwd`/python:$PYTHONPATH
echo "" >> ~/.bashrc
echo "export PYTHONPATH=`pwd`/python:$PYTHONPATH" >> ~/.bashrc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment