From 47d5401448e7e6a4d9deda9b10cb44cda3e3fb1f Mon Sep 17 00:00:00 2001 From: Sergio Bromberg Date: Mon, 4 Sep 2023 16:08:46 +0900 Subject: [PATCH 1/6] Create Dockerfile --- Dockerfile | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..45b9c8589 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,43 @@ +# 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 + +RUN conda env create --file environment.yml && conda init bash && exec bash && conda activate gaussian_splatting + +# 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 + From 0292f3c13dab064d0b2704ff39218adc73a2281d Mon Sep 17 00:00:00 2001 From: Sergio Bromberg Date: Mon, 4 Sep 2023 16:35:25 +0900 Subject: [PATCH 2/6] Update README.md for docker instructions --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index dd89890d1..e4a6131cc 100644 --- a/README.md +++ b/README.md @@ -42,6 +42,13 @@ 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 a working docker image with this repository. In order to build the container 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). + ## Cloning the Repository The repository contains submodules, thus please check it out with @@ -324,6 +331,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 From 6423a7db3936b4363b254f775814ceff4f794f83 Mon Sep 17 00:00:00 2001 From: Sergio Bromberg Date: Tue, 5 Sep 2023 12:34:37 +0900 Subject: [PATCH 3/6] Update README.md --- README.md | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index e4a6131cc..dc9fad32b 100644 --- a/README.md +++ b/README.md @@ -44,11 +44,21 @@ User [camenduru](https://github.com/camenduru) was kind enough to provide a Cola ## Docker -Use the Dockerfile to build a working docker image with this repository. In order to build the container succesfully make sure that: +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). +- 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 . +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 From b360f6bdcf8e1573c7a59ad197c32bdeb1f18b92 Mon Sep 17 00:00:00 2001 From: Sergio Bromberg Date: Tue, 5 Sep 2023 12:37:00 +0900 Subject: [PATCH 4/6] Update Dockerfile with default conda env --- Dockerfile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Dockerfile b/Dockerfile index 45b9c8589..9083dc24f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -27,6 +27,9 @@ WORKDIR /workspace/gaussian-splatting 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 From 801b37ebbc5066aa956ca70a26b577085831d820 Mon Sep 17 00:00:00 2001 From: Sergio Bromberg Date: Tue, 5 Sep 2023 12:56:24 +0900 Subject: [PATCH 5/6] Update Dockerfile --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index 9083dc24f..d37cdaebd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -44,3 +44,4 @@ WORKDIR /workspace/gaussian-splatting/SIBR_viewers RUN cmake -Bbuild . -DCMAKE_BUILD_TYPE=Release && \ cmake --build build -j24 --target install +WORKDIR /workspace/gaussian-splatting From 75c0ce9e4461fcd49c7d1488767ebd5a9e3821d8 Mon Sep 17 00:00:00 2001 From: Sergio Bromberg Date: Tue, 5 Sep 2023 19:25:13 +0900 Subject: [PATCH 6/6] Update README.md, typo in docker build --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index dc9fad32b..fc5257aa6 100644 --- a/README.md +++ b/README.md @@ -55,7 +55,7 @@ Build your docker image from the Dockerfile by downloading the [Dockerfile](http mkdir gaussian_splatting cd gaussian_splatting wget https://raw.githubusercontent.com/sergiobd/gaussian-splatting-docker/docker/Dockerfile -build -t gaussian_splatting . +docker build -t gaussian_splatting . 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.