Skip to content

Commit

Permalink
Merge pull request #168 from janrope/vscode_devcontainer
Browse files Browse the repository at this point in the history
[Enhancement] devcontainer
  • Loading branch information
Ivan-Zhong committed Aug 7, 2023
2 parents d2a7082 + 5368882 commit 55575ad
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Container base image
# PyTorch image with Python 3.9
ARG BASE_IMAGE="pytorch/pytorch:1.11.0-cuda11.3-cudnn8-runtime"
FROM ${BASE_IMAGE}

# Set display variable to enable rendering through system X server.
# Display and rendering only works with running X server.
ENV DISPLAY=host.docker.internal:0.0

# Update and upgrade standard stuff
RUN apt-get update -y && DEBIAN_FRONTEND=noninteractive apt-get install software-properties-common -y && \
add-apt-repository -y multiverse && apt-get update -y && apt-get upgrade -y && \
apt-get install -y apt-utils nano vim man build-essential wget sudo && \
rm -rf /var/lib/apt/lists/*
RUN apt-get update -y && apt-get install -y curl libssl-dev openssl libopenblas-dev \
libhdf5-dev hdf5-helpers hdf5-tools libhdf5-serial-dev libprotobuf-dev protobuf-compiler git

# Enable opengl to show OpenGL based rendering of environments
RUN apt-get update -y && apt-get install -y python-opengl

# Install GPUtil for GPU system monitoring via ray
RUN pip install GPUtil
24 changes: 24 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/ubuntu
{
"name": "dev-container-MARLlib",

// Use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"build": {
// Path is relative to the devcontainer.json file.
"dockerfile": "Dockerfile"
},

// An array of Docker CLI arguments that should be used when running the container
"runArgs": [
// Use available GPUs
"--gpus","all",
"--shm-size","16gb" //Make sure to set this to more than 30% of available RAM.
],

// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "bash ./.devcontainer/postCreateCommand.sh",

// Connect as root. More info: https://aka.ms/dev-containers-non-root.
"remoteUser": "root"
}
12 changes: 12 additions & 0 deletions .devcontainer/postCreateCommand.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash

# Install MARLlib as editable python package
cd /workspaces/MARLlib && pip install -e .

# Install specific protobuf version to fix ray 1.8 protobuf bug
# TODO - remove when upgrading dependencies
# BUG - tensorboardx probably not working as expected due to this temporary fix
pip install protobuf==3.20

# Install dependencies for test suite
pip install pytest pytest-cov

0 comments on commit 55575ad

Please sign in to comment.