Last active
August 29, 2015 14:21
-
-
Save fallthrough/a2fbfa28cd48e03c9c2c to your computer and use it in GitHub Desktop.
Caffe GPU Installation (2015-05-14)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
wget http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1404/x86_64/cuda-repo-ubuntu1404_7.0-28_amd64.deb | |
sudo dpkg -i cuda-repo-ubuntu1404_7.0-28_amd64.deb | |
sudo apt-add-repository multiverse | |
sudo apt-get update | |
sudo apt-get install -y --no-install-recommends \ | |
linux-image-extra-virtual linux-image-extra-$(uname -r) linux-headers-virtual linux-headers-$(uname -r) \ | |
cuda \ | |
git build-essential \ | |
libopenblas-dev libprotobuf-dev libboost-all-dev libleveldb-dev libopencv-dev libsnappy-dev libhdf5-serial-dev libgflags-dev libgoogle-glog-dev liblmdb-dev protobuf-compiler python-dev libffi-dev \ | |
ipython python-pip python-pil cython python-numpy python-scipy python-skimage python-sklearn python-matplotlib python-h5py python-leveldb python-networkx python-nose python-pandas python-protobuf python-gflags graphviz | |
sudo bash -c 'echo /usr/local/cuda/lib64 > /etc/ld.so.conf.d/cuda.conf' | |
sudo ldconfig | |
sudo bash -c 'echo "exec nvidia-smi" > /etc/rc2.d/S99nvidia-probe' | |
sudo chmod 755 /etc/rc2.d/S99nvidia-probe | |
sudo nvidia-smi | |
cd | |
git clone https://github.com/BVLC/caffe | |
cd caffe | |
git checkout 2382b096 | |
sudo pip install -r python/requirements.txt | |
wget -O Makefile.config https://gist.github.com/fallthrough/a2fbfa28cd48e03c9c2c/raw/2fd9f9570028dac87fd50b6dd37124d915c8b441/Makefile.config | |
make -j 8 distribute | |
sudo cp distribute/bin/* /usr/local/bin/ | |
sudo cp -r distribute/include/caffe /usr/local/include/ | |
sudo cp distribute/lib/* /usr/local/lib/ | |
sudo cp -r distribute/python/caffe /usr/local/lib/python2.7/dist-packages/ | |
sudo rm -rf build .build_release | |
sudo ldconfig |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Refer to http://caffe.berkeleyvision.org/installation.html | |
# Contributions simplifying and improving our build system are welcome! | |
# cuDNN acceleration switch (uncomment to build with cuDNN). | |
# USE_CUDNN := 1 | |
# CPU-only switch (uncomment to build without GPU support). | |
# CPU_ONLY := 1 | |
# To customize your choice of compiler, uncomment and set the following. | |
# N.B. the default for Linux is g++ and the default for OSX is clang++ | |
# CUSTOM_CXX := g++ | |
# CUDA directory contains bin/ and lib/ directories that we need. | |
CUDA_DIR := /usr/local/cuda | |
# On Ubuntu 14.04, if cuda tools are installed via | |
# "sudo apt-get install nvidia-cuda-toolkit" then use this instead: | |
# CUDA_DIR := /usr | |
# CUDA architecture setting: going with all of them. | |
# For CUDA < 6.0, comment the *_50 lines for compatibility. | |
CUDA_ARCH := -gencode arch=compute_20,code=sm_20 \ | |
-gencode arch=compute_20,code=sm_21 \ | |
-gencode arch=compute_30,code=sm_30 \ | |
-gencode arch=compute_35,code=sm_35 \ | |
-gencode arch=compute_50,code=sm_50 \ | |
-gencode arch=compute_50,code=compute_50 | |
# BLAS choice: | |
# atlas for ATLAS (default) | |
# mkl for MKL | |
# open for OpenBlas | |
BLAS := open | |
# Custom (MKL/ATLAS/OpenBLAS) include and lib directories. | |
# Leave commented to accept the defaults for your choice of BLAS | |
# (which should work)! | |
# BLAS_INCLUDE := /path/to/your/blas | |
# BLAS_LIB := /path/to/your/blas | |
# This is required only if you will compile the matlab interface. | |
# MATLAB directory should contain the mex binary in /bin. | |
# MATLAB_DIR := /usr/local | |
# MATLAB_DIR := /Applications/MATLAB_R2012b.app | |
# NOTE: this is required only if you will compile the python interface. | |
# We need to be able to find Python.h and numpy/arrayobject.h. | |
PYTHON_INCLUDE := /usr/include/python2.7 \ | |
/usr/lib/python2.7/dist-packages/numpy/core/include | |
# Anaconda Python distribution is quite popular. Include path: | |
# Verify anaconda location, sometimes it's in root. | |
# ANACONDA_HOME := $(HOME)/anaconda | |
# PYTHON_INCLUDE := $(ANACONDA_HOME)/include \ | |
# $(ANACONDA_HOME)/include/python2.7 \ | |
# $(ANACONDA_HOME)/lib/python2.7/site-packages/numpy/core/include \ | |
# We need to be able to find libpythonX.X.so or .dylib. | |
PYTHON_LIB := /usr/lib | |
# PYTHON_LIB := $(ANACONDA_HOME)/lib | |
# Uncomment to support layers written in Python (will link against Python libs) | |
# WITH_PYTHON_LAYER := 1 | |
# Whatever else you find you need goes here. | |
INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include | |
LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib | |
# Uncomment to use `pkg-config` to specify OpenCV library paths. | |
# (Usually not necessary -- OpenCV libraries are normally installed in one of the above $LIBRARY_DIRS.) | |
# USE_PKG_CONFIG := 1 | |
BUILD_DIR := build | |
DISTRIBUTE_DIR := distribute | |
# Uncomment for debugging. Does not work on OSX due to https://github.com/BVLC/caffe/issues/171 | |
# DEBUG := 1 | |
# The ID of the GPU that 'make runtest' will use to run unit tests. | |
TEST_GPUID := 0 | |
# enable pretty build (comment to see full commands) | |
Q ?= @ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment