Skip to content

Instantly share code, notes, and snippets.

@mrcoles
Created January 16, 2018 17:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mrcoles/2679eb0bfad999f9bb2b3df758dad059 to your computer and use it in GitHub Desktop.
Save mrcoles/2679eb0bfad999f9bb2b3df758dad059 to your computer and use it in GitHub Desktop.
Setup script for fast.ai on an rc cluster machine
#!/usr/bin/env bash
# derived from https://github.com/fastai/courses/blob/master/setup/install-gpu.sh
# exit on failed commands also print all commands
set -ex
cd $HOME
# ## NOTE - we do not have sudo access on these machines
# # ensure system is updated and has basic build tools
# sudo apt-get update
# sudo apt-get --assume-yes upgrade
# sudo apt-get --assume-yes install tmux build-essential gcc g++ make binutils
# sudo apt-get --assume-yes install software-properties-common
# ## NOTE - GPU drivers are already installed
# # download and install GPU drivers
# wget "http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/cuda-repo-ubuntu1604_8.0.44-1_amd64.deb" -O "cuda-repo-ubuntu1604_8.0.44-1_amd64.deb"
# sudo dpkg -i cuda-repo-ubuntu1604_8.0.44-1_amd64.deb
# sudo apt-get update
# sudo apt-get -y install cuda
# sudo modprobe nvidia
# nvidia-smi
# Install Anaconda
DOWNLOADS=$HOME/downloads
mkdir -p $DOWNLOADS
cd $DOWNLOADS
wget "https://repo.continuum.io/archive/Anaconda2-4.2.0-Linux-x86_64.sh" -O "Anaconda2-4.2.0-Linux-x86_64.sh"
bash "Anaconda2-4.2.0-Linux-x86_64.sh" -b
echo "export PATH=\"$HOME/anaconda2/bin:\$PATH\"" >> ~/.bashrc
export PATH="$HOME/anaconda2/bin:$PATH"
conda install -y bcolz
conda upgrade -y --all
# install and configure theano
pip install theano
echo "[global]
device = gpu
floatX = float32
[cuda]
root = /usr/local/cuda" > ~/.theanorc
# install and configure keras
pip install keras==1.2.2
mkdir ~/.keras
echo '{
"image_dim_ordering": "th",
"epsilon": 1e-07,
"floatx": "float32",
"backend": "theano"
}' > ~/.keras/keras.json
# ## NOTE - these are already installed
#
# # install cudnn libraries
# wget "http://files.fast.ai/files/cudnn.tgz" -O "cudnn.tgz"
# tar -zxf cudnn.tgz
# cd cuda
# sudo cp lib64/* /usr/local/cuda/lib64/
# sudo cp include/* /usr/local/cuda/include/
# configure jupyter and prompt for password
jupyter notebook --generate-config
jupass=`python -c "from notebook.auth import passwd; print(passwd())"`
echo "c.NotebookApp.password = u'"$jupass"'" >> $HOME/.jupyter/jupyter_notebook_config.py
echo "c.NotebookApp.ip = '*'
c.NotebookApp.open_browser = False" >> $HOME/.jupyter/jupyter_notebook_config.py
# clone the fast.ai course repo and prompt to start notebook
cd $HOME
if [ ! -d courses ]; then
git clone https://github.com/fastai/courses.git
echo "\"jupyter notebook\" will start Jupyter on port 8888"
echo "If you get an error instead, try restarting your session so your $PATH is updated"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment