Last active
September 6, 2016 14:51
-
-
Save mitmul/217d26bd028b0e12c771 to your computer and use it in GitHub Desktop.
Construct CUDA & Anaconda & Caffe environment on EC2 g2.2xlarge instance
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 | |
sudo aptitude update | |
sudo aptitude full-upgrade -y | |
sudo reboot | |
wget http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1404/x86_64/cuda-repo-ubuntu1404_6.5-14_amd64.deb | |
sudo dpkg -i cuda-repo-ubuntu1404_6.5-14_amd64.deb | |
sudo aptitude update | |
sudo aptitude install -y linux-image-extra-virtual | |
sudo aptitude install -y cuda | |
echo 'export PATH=/usr/local/cuda/bin:$PATH' >> .bashrc | |
echo 'export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH' >> .bashrc | |
source .bashrc | |
sudo reboot | |
# Install Anaconda | |
wget http://09c8d0b2229f813c1b93-c95ac804525aac4b6dba79b00b39d1d3.r79.cf1.rackcdn.com/Anaconda-2.1.0-Linux-x86_64.sh | |
bash Anaconda-2.1.0-Linux-x86_64.sh -b | |
rm -rf Anaconda-2.1.0-Linux-x86_64.sh | |
echo 'export PATH=/home/ubuntu/anaconda/bin:$PATH' >> .bashrc | |
echo 'export LD_LIBRARY_PATH=$HOME/anaconda/lib:$LD_LIBRARY_PATH' >> .bashrc | |
echo 'export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH' >> .bashrc | |
source .bashrc | |
conda update conda --yes | |
sudo aptitude install -y libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libboost-all-dev libhdf5-serial-dev libgflags-dev libgoogle-glog-dev liblmdb-dev protobuf-compiler git libatlas-dev libatlas3-base libatlas-base-dev | |
sudo chown -R ubuntu:ubuntu /mnt | |
cd /mnt | |
git clone https://github.com/BVLC/caffe.git | |
cp Makefile.config.example Makefile.config | |
mv $HOME/anaconda/lib/libm.so $HOME/anaconda/lib/libm.so.tmp | |
mv $HOME/anaconda/lib/libm.so.6 $HOME/anaconda/lib/libm.so.6.tmp | |
sed -i -e "s/#-gencode arch=compute_50,code=sm_50/-gencode arch=compute_50,code=sm_50/g" Makefile.config | |
sed -i -e "s/#-gencode arch=compute_50,code=compute_50/-gencode arch=compute_50,code=compute_50/g" Makefile.config | |
sed -i -e "s/PYTHON_INCLUDE := \/usr\/include\/python2.7/#PYTHON_INCLUDE := \/usr\/include\/python2.7/g" Makefile.config | |
sed -i -e "s/\/usr\/lib\/python2.7\/dist-packages\/numpy\/core\/include/#\/usr\/lib\/python2.7\/dist-packages\/numpy\/core\/include/g" Makefile.config | |
sed -i -e "s/# PYTHON_INCLUDE := \$(HOME)\/anaconda\/include/PYTHON_INCLUDE := \$(HOME)\/anaconda\/include/g" Makefile.config | |
sed -i -e "s/# \$(HOME)\/anaconda\/include\/python2.7/\$(HOME)\/anaconda\/include\/python2.7/g" Makefile.config | |
sed -i -e "s/# \$(HOME)\/anaconda\/lib\/python2.7\/site-packages\/numpy\/core\/include/\$(HOME)\/anaconda\/lib\/python2.7\/site-packages\/numpy\/core\/include/g" Makefile.config | |
sed -i -e "s/PYTHON_LIB := \/usr\/lib/# PYTHON_LIB := \/usr\/lib/g" Makefile.config | |
sed -i -e "s/# PYTHON_LIB := \$(HOME)\/anaconda\/lib/PYTHON_LIB := \$(HOME)\/anaconda\/lib/g" Makefile.config | |
make all -j8 | |
make test -j8 | |
make runtest |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment