-
-
Save aa1607/17a502bab0c0c0714c1c231dd116d941 to your computer and use it in GitHub Desktop.
Set up a Google Cloud GPU instance for doing the exercises in course.fast.ai
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 | |
if ! dpkg-query -W cuda; then | |
curl -O http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/cuda-repo-ubuntu1604_8.0.61-1_amd64.deb | |
dpkg -i ./cuda-repo-ubuntu1604_8.0.61-1_amd64.deb | |
fi | |
apt-get update | |
apt-get -y upgrade | |
apt-get -y install tmux build-essential gcc g++ make binutils software-properties-common cuda unzip | |
modprobe nvidia | |
nvidia-smi | |
mkdir downloads | |
cd downloads | |
# Replace with an anaconda mirror near your server | |
wget "https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/Anaconda2-4.3.0-Linux-x86_64.sh" -O "anaconda-install.sh" | |
bash "anaconda-install.sh" -b | |
echo "export PATH=\"$HOME/anaconda2/bin:\$PATH\"" >> ~/.bashrc | |
export PATH="$HOME/anaconda2/bin:$PATH" | |
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/ | |
conda config --set show_channel_urls yes | |
conda install -y bcolz | |
conda upgrade -y --all | |
pip install theano | |
echo "[global] | |
device = gpu | |
floatX = float32 | |
[cuda] | |
root = /usr/local/cuda" > ~/.theanorc | |
pip install keras | |
mkdir ~/.keras | |
echo '{ | |
"image_dim_ordering": "th", | |
"epsilon": 1e-07, | |
"floatx": "float32", | |
"backend": "theano" | |
}' > ~/.keras/keras.json | |
wget "http://platform.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/ | |
jupyter notebook --generate-config | |
# Replace with your own password hash | |
echo "c.NotebookApp.password = u'sha1:d12dfae8859909bcde06a4192d604d347d06da8c:0943f80b4790'" >> $HOME/.jupyter/jupyter_notebook_config.py | |
echo "c.NotebookApp.ip = '*' | |
c.NotebookApp.port = 443 | |
c.NotebookApp.open_browser = False" >> $HOME/.jupyter/jupyter_notebook_config.py | |
cd ~ | |
git clone https://github.com/fastai/courses.git | |
cd ~/courses/deeplearning1/nbs | |
openssl req -x509 -nodes -days 3650 -newkey rsa:1024 -keyout ~/mykey.key -out ~/mycert.pem | |
jupyter notebook --certfile=~/mycert.pem --keyfile ~/mykey.key |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment