Skip to content

Instantly share code, notes, and snippets.

@thomelane
Last active September 13, 2018 23:55
Show Gist options
  • Save thomelane/cc27018132a8a85720807afa505eafa8 to your computer and use it in GitHub Desktop.
Save thomelane/cc27018132a8a85720807afa505eafa8 to your computer and use it in GitHub Desktop.
Coach Install on AWS EC2 p3.2xlarge

On local MacOS machine...

  1. Install XQuartz (https://www.xquartz.org/)
  2. Enable GLX for XQuartz, by running following in terminal;

defaults write org.macosforge.xquartz.X11 enable_iglx -bool true

  1. Start AWS EC2 p3.2xlarge instance
  2. SSH onto instance using -X option, e.g. ssh -X -i keypair.pem ubuntu@instance-ip.com
  3. XQuartz window should open on local machine

On remote AWS EC2 instance...

  1. Confirm X is working correctly (you should see 3d gears appear in an XQuartz window)
sudo apt-get install mesa-utils
glxgears
  1. Create environment for coach
conda create --name coach_env --yes python=3.6 pip jupyter
source activate coach_env

# currently wxpython build is breaking, so use pre-built wheel instead (before pip install rl_coach)
# see https://extras.wxpython.org/wxPython4/extras/linux/ for correct version
wget https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-16.04/wxPython-4.0.1-cp36-cp36m-linux_x86_64.whl
pip install wxPython-4.0.1-cp36-cp36m-linux_x86_64.whl

# add pygame requirements (from coach readme)
sudo -E apt-get install libsdl-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-ttf2.0-dev libsmpeg-dev libportmidi-dev libavformat-dev libswscale-dev -y

# add dashboard requirements (from coach readme)
sudo -E apt-get install dpkg-dev build-essential python3.5-dev libjpeg-dev  libtiff-dev libsdl1.2-dev libnotify-dev  freeglut3 freeglut3-dev libsm-dev libgtk2.0-dev libgtk-3-dev libwebkitgtk-dev libgtk-3-dev libwebkitgtk-3.0-dev libgstreamer-plugins-base1.0-dev -y

# add gym requirements (from coach readme)
sudo -E apt-get install libav-tools libsdl2-dev swig cmake -y

# install coach package (in development mode)
git clone https://github.com/NervanaSystems/coach.git
cd coach
pip install -e .

# force upgrade of tensorflow package (that uses correct version of CUDA, i.e. 9.0)
# coach's setup.py is pinned to tensorflow-gpu==1.4.0 which looks for CUDA 8.0
# -I ignores the `tensorflow-gpu` current package, and overwrites.
pip install -I tensorflow-gpu==1.5.0

# Install Atari evironment (optional)
pip install gym[atari]
  1. Quit SSH session, restart, and source activate coach_env.

  2. Confirm coach is working correctly (super slow rendering!)

coach -r -p CartPole_PG

  1. Without rendering, training is much quicker.

coach -p CartPole_PG

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment