minosworld / minos

MINOS: Multimodal Indoor Simulator
MIT License
201 stars 33 forks source link

Slow when running from Docker #130

Closed inconst closed 5 years ago

inconst commented 5 years ago

I installed MINOS on my computer and when I run node benchmark.js I get these numbers:

Timing loadScene: 2001.126ms
Loaded p5dScene.0020d9dab70c6c8cfc0564c139c82dce bbdims: [1028.947265625,275.0000035762787,608.5391100049019]
buildBVH.scene: 124.883ms
SimState.sample: 173.360ms
SimState.sample: 54.873ms
Removing subscribers for event drain [ 0 ]
standalone, 5.738s fps=174.27675148135236
[headless-gl-nvidia] Terminating EGL display

Then when I run it using Docker locally with docker run, I get this output from benchmark:

Timing loadScene: 2745.915ms
Loaded p5dScene.0020d9dab70c6c8cfc0564c139c82dce bbdims: [1028.947265625,275.0000035762787,608.5391100049019]
buildBVH.scene: 332.594ms
SimState.sample: 412.545ms
SimState.sample: 165.858ms
Removing subscribers for event drain [ 0 ]
standalone, 18.792s fps=53.21413367390378
[headless-gl-nvidia] Terminating EGL display

Here's my Docker file.

FROM nvidia/cudagl:9.0-devel-ubuntu16.04

WORKDIR /workspace
RUN chmod -R a+w /workspace
ENV NVM_DIR /usr/local/nvm
ENV NODE_VERSION 10.12.0
ENV NODE_PATH $NVM_DIR/versions/node/v$NODE_VERSION/lib/node_modules
ENV PATH      $NVM_DIR/versions/node/v$NODE_VERSION/bin:$PATH

# install basic dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
         build-essential python python3-pip cmake git curl vim ca-certificates wget pkg-config \
         libjpeg-dev libpng-dev libxi-dev libglu1-mesa-dev libglew-dev libvips &&\
     rm -rf /var/lib/apt/lists/*

# install node-js
RUN mkdir $NVM_DIR && curl https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash \
    && . $NVM_DIR/nvm.sh \
    && nvm install $NODE_VERSION \
    && nvm alias default $NODE_VERSION \
    && nvm use default

# install minos with all dependencies
RUN git clone https://github.com/minosworld/minos
RUN cd minos/minos/server && npm config set strict-ssl false && NODE_TLS_REJECT_UNAUTHORIZED=0 npm install
RUN apt-get update && apt-get install -y python-dev python3-dev
RUN cd minos && pip3 install setuptools wheel && pip3 install -e . && \
    pip3 install -r requirements.txt && cd gym && pip3 install -e .

# install headless-gl
COPY ./headless-gl-nvidia ./headless-gl
RUN pip3 install glad && cd headless-gl/src/gl_context && mkdir build && cd build && cmake .. && make
RUN cd headless-gl && rm -r build && npm install && npm run rebuild
RUN cp headless-gl/build/Release/webgl.node minos/minos/server/node_modules/sstk/node_modules/gl/build/Release/webgl.node
ENV CUDA_VISIBLE_DEVICES 0

When installing on my computer I've done pretty much the same as in this Docker file (installing headless-gl as well, so this is not the cause of overhead). I think it shouldn't be just overhead from docker, so possibly in Docker I've build MINOS in way that some optimizations are disabled. Could you reproduce the issue?

inconst commented 5 years ago

Changing to nvidia/cudagl:10.0-devel-ubuntu18.04 image in Docker somehow solves the issue, not sure why