Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/docker #19

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
build/
*.so
*.a
nn/
.vscode/
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ build/
*.so
*.a
nn/
.vscode/
28 changes: 28 additions & 0 deletions Docker.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Run MASS in docker

Build the docker image

docker build -t mass .

Run the docker image, but replace `/tmp/mass_models` with the folder you wich to store the models in.

xhost +local:root
docker run -it --gpus all -e NVIDIA_DRIVER_CAPABILITIES=graphics,compute,utility -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix -v /tmp/mass_models:/opt/nn mass

`--gpus all` is to enable the container to use your Nvidia graphics card. If you do not have an Nvidia GPU, you can run the container without these flags.
Capability `graphics` are to render gui using the provided display. `compute` is to use the gpu in training. `utility` is to enable system monitoring

`-e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix` is to enable the docker container to use your display to render gui applications
Enable the docker container to use your display by typing `xhost +local:root` and disable by replacing the `+` with a `-` when you are finished to keep your system secure.

Open a terminal in vscode and start the trainer

python3 ./python/main.py -d data/metadata.txt

When a model is trained, you can start the renderer

build/render/render data/metadata.txt ../nn/max.pt ../nn/max_muscle.pt

## Visual Studio Code

Open vscode with extensions `Docker` and `Remote - Containers` and with the image running, you should see the container `mass` under containers in the Docker-tab. Right-click the `mass` container and `Attatch Visual Studio Code`
55 changes: 55 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
FROM nvidia/cuda:10.1-base

RUN apt-get update
WORKDIR /opt
# set noninteractive installation
ENV DEBIAN_FRONTEND=noninteractive
#install tzdata package
RUN apt-get install -y tzdata
# set your timezone
RUN ln -fs /usr/share/zoneinfo/Europe/Oslo /etc/localtime
RUN dpkg-reconfigure --frontend noninteractive tzdata
ENV LC_ALL=C.UTF-8
ENV LANG=C.UTF-8

RUN apt-get install -y libtinyxml-dev libeigen3-dev libxi-dev libxmu-dev freeglut3-dev libassimp-dev libpython3-dev python3-tk python3-numpy virtualenv ipython3 cmake-curses-gui wget git

#BOOST
RUN wget https://dl.bintray.com/boostorg/release/1.66.0/source/boost_1_66_0.tar.gz
RUN mkdir /opt/boost
RUN tar xzvf boost_1_66_0.tar.gz -C /opt/boost
WORKDIR /opt/boost/boost_1_66_0
RUN ./bootstrap.sh --with-python=python3
RUN ./b2 --with-python --with-filesystem --with-system --with-regex install


#DART
RUN apt-get install -y build-essential libccd-dev libfcl-dev libboost-regex-dev libboost-system-dev libbullet-dev libode-dev libtinyxml2-dev liburdfdom-dev libopenscenegraph-dev
WORKDIR /opt
RUN git clone git://github.com/dartsim/dart.git
WORKDIR /opt/dart
RUN git checkout tags/v6.3.1
RUN mkdir build
WORKDIR /opt/dart/build
RUN cmake ..
RUN make install

#PyTorch
WORKDIR /opt
RUN apt-get install -y python3-pip
RUN pip3 install torch torchvision
RUN pip3 install numpy matplotlib ipython
RUN pip3 install --upgrade wandb

#MASS
WORKDIR /opt
COPY . /opt/MASS/
WORKDIR /opt/MASS
RUN mkdir build
WORKDIR /opt/MASS/build
RUN cmake ..
RUN make -j8

WORKDIR /opt/MASS
VOLUME /opt/nn
ENV LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ Paper : http://mrl.snu.ac.kr/research/ProjectScalable/Paper.pdf

## How to install

### To use Docker, follow the instructions provided at [Docker.md](./Docker.md)

### Install TinyXML, Eigen, OpenGL, assimp, Python3, etc...

```bash
Expand Down