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

Added a Dockerfile and instructions to build it #163

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 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
47 changes: 47 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Use the base image with PyTorch and CUDA support
FROM pytorch/pytorch:2.0.1-cuda11.7-cudnn8-devel


# NOTE:
# Building the libraries for this repository requires cuda *DURING BUILD PHASE*, therefore:
# - The default-runtime for container should be set to "nvidia" in the deamon.json file. See this: https://github.com/NVIDIA/nvidia-docker/issues/1033
# - For the above to work, the nvidia-container-runtime should be installed in your host. Tested with version 1.14.0-rc.2
# - Make sure NVIDIA's drivers are updated in the host machine. Tested with 525.125.06

ENV DEBIAN_FRONTEND=noninteractive

# Update and install tzdata separately
RUN apt update && apt install -y tzdata

# Install necessary packages
RUN apt install -y git && \
apt install -y libglew-dev libassimp-dev libboost-all-dev libgtk-3-dev libopencv-dev libglfw3-dev libavdevice-dev libavcodec-dev libeigen3-dev libxxf86vm-dev libembree-dev && \
apt clean && apt install wget && rm -rf /var/lib/apt/lists/*

# Create a workspace directory and clone the repository
WORKDIR /workspace
RUN git clone https://github.com/graphdeco-inria/gaussian-splatting --recursive

# Create a Conda environment and activate it
WORKDIR /workspace/gaussian-splatting

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add somewhere ( for CUDA >11.0 )

ARG TORCH_CUDA_ARCH_LIST="3.5;5.0;6.0;6.1;7.0;7.5;8.0;8.6+PTX"

RUN conda env create --file environment.yml && conda init bash && exec bash && conda activate gaussian_splatting

# Make gaussian_splatting the default environment on start
RUN echo "conda activate gaussian_splatting" >> /root/.bashrc

# Tweak the CMake file for matching the existing OpenCV version. Fix the naming of FindEmbree.cmake
WORKDIR /workspace/gaussian-splatting/SIBR_viewers/cmake/linux
RUN sed -i 's/find_package(OpenCV 4\.5 REQUIRED)/find_package(OpenCV 4.2 REQUIRED)/g' dependencies.cmake
RUN sed -i 's/find_package(embree 3\.0 )/find_package(EMBREE)/g' dependencies.cmake
RUN mv /workspace/gaussian-splatting/SIBR_viewers/cmake/linux/Modules/FindEmbree.cmake /workspace/gaussian-splatting/SIBR_viewers/cmake/linux/Modules/FindEMBREE.cmake

# Fix the naming of the embree library in the rayscaster's cmake
RUN sed -i 's/\bembree\b/embree3/g' /workspace/gaussian-splatting/SIBR_viewers/src/core/raycaster/CMakeLists.txt

# Ready to build the viewer now.
WORKDIR /workspace/gaussian-splatting/SIBR_viewers
RUN cmake -Bbuild . -DCMAKE_BUILD_TYPE=Release && \
cmake --build build -j24 --target install

WORKDIR /workspace/gaussian-splatting
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,23 @@ Jonathan Stephens made a fantastic step-by-step tutorial for setting up Gaussian

User [camenduru](https://github.com/camenduru) was kind enough to provide a Colab template that uses this repo's source (status: August 2023!) for quick and easy access to the method. Please check it out [here](https://github.com/camenduru/gaussian-splatting-colab).

## Docker

Use the Dockerfile to build an (Ubuntu 22.04) image with this repository. In order to build the image succesfully make sure that:
- NVIDIA's drivers are updated in the host machine (tested with 525.125.06)
- The default-runtime for docker is set to `nvidia` in the `/etc/docker/daemon.json` file. See [this](https://github.com/NVIDIA/nvidia-docker/issues/1033).
- For the above to work, the [nvidia-container-toolkit](https://gitlab.com/nvidia/container-toolkit/container-toolkit) should be installed in your host (tested with version 1.14.0-rc.2).

Build your docker image from the Dockerfile by downloading the [Dockerfile](https://github.com/sergiobd/gaussian-splatting-docker/blob/docker/Dockerfile) and placing it in an empty folder. You can do this manually or by using `wget`. Then, build the docker image and run it with GPU enabled.

```
mkdir gaussian_splatting
cd gaussian_splatting
wget https://raw.githubusercontent.com/sergiobd/gaussian-splatting-docker/docker/Dockerfile
build -t gaussian_splatting .
sergiobd marked this conversation as resolved.
Show resolved Hide resolved
docker run -it --gpus all --name gaussian_splatting --shm-size=64g -v /your/local/shared/folder:/workspace/data gaussian_splatting:latest bash
```
Please refer to [Docker's documentation](https://docs.docker.com/) for specific docker instructions.
## Cloning the Repository

The repository contains submodules, thus please check it out with
Expand Down Expand Up @@ -324,6 +341,7 @@ cd SIBR_viewers
cmake -Bbuild . -DCMAKE_BUILD_TYPE=Release # add -G Ninja to build faster
cmake --build build -j24 --target install
```
Alternatively, you can build a docker image using the Dockerfile mentioned above.

#### Ubuntu 20.04
Backwards compatibility with Focal Fossa is not fully tested, but building SIBR with CMake should still work after invoking
Expand Down