Skip to content
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
75 changes: 75 additions & 0 deletions resources/docker/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# Docker files for Mitsuba 2

Here are Docker files for running Mitsuba 2 either CPU only, or also with GPU support.

**Attention!** For GPU and CUDA/OptiX to work, you need to have new Nvidia drivers with builtin OptiX libraries, and also updated Docker and Nvidia Docker that provide proper mounting of OptiX libraries. You do **not** need to install OptiX SDK, it is **not** necessary for new versions of Mitsuba 2! Only the updated Nvidia drivers and Docker are needed.

## Building the images

Building the CPU only version:

```
cd /path/to/mitsuba2/resources/docker
docker build -t mitsuba2:cpu -f linux-cpu.Dockerfile .
```

Building the CPU/GPU version:

```
cd /path/to/mitsuba2/resources/docker
docker build -t mitsuba2:gpu -f linux-gpu.Dockerfile .
```

The images will be tagged as `mitsuba2:cpu` or `mitsuba2:gpu`.

## Starting the containers

Running the CPU image:

```
cd /path/to/mitsuba2
docker run -it -p 45678:8888 -v $(pwd):/mitsuba2 -u $(id -u):$(id -g) mitsuba2:cpu bash
```

This will mount the Mitsuba 2 root directory to `/mitsuba2` inside the container and map port `8888` (used for Jupyter) from the container to port `45678` in the host machine.

Running the GPU image:

```
cd /path/to/mitsuba2
docker run --runtime=nvidia --gpus all -it -p 45678:8888 -v $(pwd):/mitsuba2 -u $(id -u):$(id -g) mitsuba2:gpu bash
```

This will do the same as above, and also mount all available GPUs to the container. You can try running `nvidia-smi` inside the container to verify the GPUs have been mounted correctly.

## Compiling Mitsuba 2

Works the same as described in Mitsuba 2 documentation.

Note: Do not forget to modify `mitsuba.conf` if you want to add GPU variants.

```
cd /mitsuba2
mkdir build
cd build
cmake -GNinja ..
ninja
```

## Running Mitsuba 2

```
cd /mitsuba2
source setpath.sh
mitsuba --help
```

## Running Jupyter

```
cd /mitsuba2
source setpath.sh
jupyter notebook --port 8888 --ip 0.0.0.0
```

And then you can connect to the Jupyter notebook via `localhost:45678` in your web browser.
32 changes: 32 additions & 0 deletions resources/docker/linux-cpu.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
FROM ubuntu:18.04

# Install build tools, including Clang and libc++ (Clang's C++ library)
RUN apt-get update && apt-get install -y \
clang-9 \
cmake \
libc++-9-dev \
libc++abi-9-dev \
libjpeg-dev \
libpng-dev \
libxcursor-dev \
libxinerama-dev \
libxrandr-dev \
libz-dev \
ninja-build \
python3-dev \
python3-distutils \
python3-setuptools \
python3-pip

# Install basic Python tools
RUN pip3 install jupyterlab numpy matplotlib ipywidgets pytest

# create /.local so that Python and Jupyter are happy
RUN mkdir /.local && chmod a+rwx /.local

# Set C/C++ compilers to Clang
ENV CC=clang-9
ENV CXX=clang++-9

WORKDIR /mitsuba2
CMD ["/bin/bash"]
36 changes: 36 additions & 0 deletions resources/docker/linux-gpu.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Start from CUDA 10.2 development image
FROM nvidia/cuda:10.2-cudnn7-devel-ubuntu18.04

ENV NVIDIA_VISIBLE_DEVICES all
ENV NVIDIA_DRIVER_CAPABILITIES compute,utility,graphics

# Install build tools, including Clang and libc++ (Clang's C++ library)
RUN apt-get update && apt-get install -y \
clang-9 \
cmake \
libc++-9-dev \
libc++abi-9-dev \
libjpeg-dev \
libpng-dev \
libxcursor-dev \
libxinerama-dev \
libxrandr-dev \
libz-dev \
ninja-build \
python3-dev \
python3-distutils \
python3-setuptools \
python3-pip

# Install basic Python tools
RUN pip3 install jupyterlab numpy matplotlib ipywidgets pytest

# create /.local so that Python and Jupyter are happy
RUN mkdir /.local && chmod a+rwx /.local

# Set C/C++ compilers to Clang
ENV CC=clang-9
ENV CXX=clang++-9

WORKDIR /mitsuba2
CMD ["/bin/bash"]