Skip to content

Instantly share code, notes, and snippets.

@ebenolson
Last active November 10, 2015 00:26
Show Gist options
  • Save ebenolson/3246cbecadc9e160c93b to your computer and use it in GitHub Desktop.
Save ebenolson/3246cbecadc9e160c93b to your computer and use it in GitHub Desktop.
gpu demo box setup.sh
#!/bin/bash
cd ~/pydata2015
git pull
source ~/miniconda2/bin/activate py27
# register with landing page
curl --form ip="`curl http://169.254.169.254/latest/meta-data/public-ipv4`" http://pydata.ebenolson.com/addip
# start notebook server
ipython notebook --ip="*"
USERDATA=$(curl https://gist.githubusercontent.com/ebenolson/3246cbecadc9e160c93b/raw/setup.sh | base64 -w 0)
aws ec2 request-spot-instances \
--spot-price "0.35" \
--instance-count 1 \
--launch-specification \
"{\
\"Placement\": {\"AvailabilityZone\": \"us-east-1d\"}, \
\"ImageId\": \"ami-1117a87a\", \
\"KeyName\": \"MyKeyPair\", \
\"BlockDeviceMappings\": [{\"DeviceName\": \"/dev/sda1\", \"Ebs\": {\"DeleteOnTermination\": true, \"VolumeSize\": 30, \"VolumeType\": \"standard\"}}], \
\"SecurityGroupIds\": [\"sg-1ee4ca74\"], \
\"SecurityGroups\":[\"pydata\"], \
\"EbsOptimized\": false, \
\"UserData\":\"$USERDATA\", \
\"InstanceType\": \"g2.2xlarge\" \
}"
#!/bin/bash
su ubuntu
cd ~
mkdir tmp_setup
cd tmp_setup
sudo apt-get update
sudo DEBIAN_FRONTEND=noninteractive apt-get install graphviz
sudo apt-get clean
# install CuDNN
wget https://s3.amazonaws.com/emolson/pydata/cudnn-7.0-linux-x64-v3.0-prod.tgz
tar -xf cudnn-7.0-linux-x64-v3.0-prod.tgz
sudo cp cuda/lib64/* /usr/local/cuda/lib64
sudo cp cuda/include/* /usr/local/cuda/include
# install Miniconda
wget https://repo.continuum.io/miniconda/Miniconda-latest-Linux-x86_64.sh
sudo bash Miniconda-latest-Linux-x86_64.sh -b
# set up conda env
~/miniconda2/bin/conda create -n py27 python=2.7 -y
source ~/miniconda2/bin/activate py27
conda install -y numpy
conda install -y jupyter
conda install -y matplotlib
conda install -y scikit-learn
conda install -y pydot pydot2
conda install -y scipy
conda install -y scikit-image
# set up theano and lasagne
pip install --upgrade --no-deps git+git://github.com/Theano/Theano.git
pip install --upgrade git+git://github.com/Lasagne/Lasagne.git
echo -e "\n[global]\nfloatX=float32\ndevice=gpu\n[mode]=FAST_RUN\n\n[nvcc]\nfastmath=True\n\n[cuda]\nroot=/usr/local/cuda" >> ~/.theanorc
wget https://gist.githubusercontent.com/ebenolson/3246cbecadc9e160c93b/raw/startup.sh
bash startup.sh
# fetch content
cd ~
git clone https://github.com/ebenolson/pydata2015.git
cd pydata2015
# register with landing page
curl --form ip="`curl http://169.254.169.254/latest/meta-data/public-ipv4`" http://pydata.ebenolson.com/addip
# start notebook server
ipython notebook --ip="*"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment