-
Notifications
You must be signed in to change notification settings - Fork 18.7k
Caffe on EC2 Ubuntu 14.04 Cuda 7
Here's a script which will install all caffe dependencies, download caffe, and test it. This works with this Ubuntu 14.04 AMI (which, as of this writing, is the default ubuntu HVM image), and should be somewhat robust to updates. It will install caffe wherever it is run; for the AMI, I ran it in the home directory for the ubuntu user.
If you want to use cudnn, you'll need a copy of cudnn-6.5-linux-x64-v2.tgz, in the same directory where the script is.
You can likely use this script for other ubuntu 14.04 installs, but you probably won't want to get rid of the lines that set TMPDIR to /mnt.
`
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-get update
sudo apt-get install -y opencl-headers build-essential protobuf-compiler
libprotoc-dev libboost-all-dev libleveldb-dev hdf5-tools libhdf5-serial-dev
libopencv-core-dev libopencv-highgui-dev libsnappy-dev libsnappy1
libatlas-base-dev cmake libstdc++6-4.8-dbg libgoogle-glog0 libgoogle-glog-dev
libgflags-dev liblmdb-dev git python-pip gfortran
sudo apt-get clean
#sudo apt-get install -y linux-headers-virtual linux-source linux-image-extra-virtual
sudo apt-get install -y linux-image-extra-uname -r
linux-headers-uname -r
linux-image-uname -r
sudo apt-get install -y cuda sudo apt-get clean
if [ -f "cudnn-6.5-linux-x64-v2.tgz" ] ; then tar -xvf cudnn-6.5-linux-x64-v2.tgz sudo cp -P cudnn*/libcudnn* /usr/local/cuda/lib64 sudo cp cudnn*/cudnn.h /usr/local/cuda/include fi
sudo sh -c "sudo echo '/usr/local/cuda/lib64' > /etc/ld.so.conf.d/cuda_hack.conf" sudo ldconfig /usr/local/cuda/lib64
git clone https://github.com/BVLC/caffe.git cd caffe cd python for req in $(cat requirements.txt); do sudo pip install $req; done
cd ../ cp Makefile.config.example Makefile.config if [ -f "../cudnn-6.5-linux-x64-v2.tgz" ] ; then sed -i '/^# USE_CUDNN := 1/s/^# //' Makefile.config fi sed -i '/^# WITH_PYTHON_LAYER := 1/s/^# //' Makefile.config sed -i '/^PYTHON_INCLUDE/a /usr/local/lib/python2.7/dist-packages/numpy/core/include/ \' Makefile.config
echo 'export TMPDIR=/mnt/build_tmp' >> Makefile.config sudo mkdir /mnt/build_tmp sudo chown ubuntu /mnt/build_tmp
make -j 8 all py
make -j 8 test make runtest `