-
Notifications
You must be signed in to change notification settings - Fork 0
/
install_caffe
79 lines (63 loc) · 2.79 KB
/
install_caffe
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
###for ubuntu 14.04, cuda 7.0, nvidia 346, with default atlas and CuDNN
## Before starting, make sure cpu throttling is turned off as per
## http://askubuntu.com/questions/523640/how-i-can-disable-cpu-frequency-scaling-and-set-the-system-to-performance
sudo apt-get install cpufrequtils build-essential
sudo sh -c 'echo GOVERNOR="performance" >> /etc/default/cpufrequtils'
sudo update-rc.d ondemand disable
### cuda as per http://askubuntu.com/questions/451672/installing-and-testing-cuda-in-ubuntu-14-04
cd ~/Downloads
wget http://developer.download.nvidia.com/compute/cuda/7_0/Prod/local_installers/cuda_7.0.28_linux.run
mkdir nvidia_installers
sudo chmod +7 cuda_7.0.28_linux.run
sudo ./cuda_7.0.28_linux.run -extract=~/Downloads/nvidia_installers
## press Ctrl-Alt-F1 to go to root
sudo apt-get --purge remove nvidia-*
cd nvidia_installers;
sudo service lightdm stop
sudo killall Xorg
sudo ./NVIDIA-Linux-x86_64-346.46.run # use default install options
# if "unable to load kernel module", try http://stackoverflow.com/questions/24734986/unable-to-load-the-kernel-module-nvidia-ko
sudo modprobe nvidia
sudo ./cuda-linux64-rel-7.0.28-19326674.run
sudo ./cuda-samples-linux-7.0.28-19326674.run
### test CUDA
cd /usr/local/cuda/samples
sudo chmod -R +7 *
cd 1_Utilities/deviceQuery
sudo make
./deviceQuery
lsmod | grep nv #check nvidia driver present
sudo reboot
### no need to be root anymore
### prerequisites for caffe
sudo apt-get install libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libboost-all-dev libhdf5-serial-dev
sudo apt-get install libgflags-dev libgoogle-glog-dev liblmdb-dev protobuf-compiler
sudo apt-get install gcc-4.6 g++-4.6 gcc-4.6-multilib g++-4.6-multilib libatlas-base-dev
### openblas
sudo apt-get install libopenblas-dev
### install cudnn
google-chrome https://developer.nvidia.com/rdp/assets/cudnn-65-linux-v2-asset #download .tgz
cd ~/Downloads
tar -xzvf cudnn-6.5-linux-x64-v2.tgz
sudo cp cudnn-6.5-linux-x64-v2/lib* /usr/local/cuda/lib64/
sudo cp cudnn-6.5-linux-x64-v2/cudnn.h /usr/local/cuda/include/
### get caffe
mkdir -p ~/numerics
cd ~/numerics
git clone https://github.com/BVLC/caffe.git
cd caffe
sudo pip install numpy
sudo apt-get install python-scipy python-matplotlib
cp Makefile.config.example Makefile.config
# Adjust Makefile.config: line 12 to 'CUSTOM_CXX := g++-4.6', line 33 to 'BLAS := open', line 5 to 'USE_CUDNN := 1'
sudo make all
sudo make test
export LD_LIBRARY_PATH=/usr/local/cuda/lib64
sudo sh -c 'echo export CAFFE_ROOT=/home/ryan/numerics/caffe >> ~/.bashrc'
source ~/.bashrc
sudo ldconfig /usr/local/cuda/lib64
sudo make runtest
sudo ln -s ~/numerics/caffe/build/tools/caffe /usr/bin/caffe
# make python interface as per http://peerajakwitoonchart.blogspot.co.uk/2015/02/caffe-installation-on-ubuntu-1404-log.html
sudo pip install numexpr tables
sudo make pycaffe