-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
156 lines (139 loc) · 5.81 KB
/
Copy pathDockerfile
File metadata and controls
156 lines (139 loc) · 5.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
FROM pytorch/pytorch:2.5.1-cuda12.1-cudnn9-devel
# Install dependencies
ENV QT_XCB_GL_INTEGRATION=xcb_egl
RUN apt-get update && apt-get install -y --no-install-recommends --no-install-suggests \
git \
wget \
unzip \
vim \
htop \
mc \
tmux \
ninja-build \
build-essential \
libboost-program-options-dev \
libboost-filesystem-dev \
libboost-graph-dev \
libboost-system-dev \
libeigen3-dev \
libflann-dev \
libfreeimage-dev \
libmetis-dev \
libgoogle-glog-dev \
libgtest-dev \
libsqlite3-dev \
libglew-dev \
qtbase5-dev \
libqt5opengl5-dev \
libcgal-dev \
libceres-dev \
&& rm -rf /var/lib/apt/lists/*
# Build and install CMake
RUN wget https://github.com/Kitware/CMake/releases/download/v3.31.3/cmake-3.31.3-linux-x86_64.sh \
-q -O /tmp/cmake-install.sh \
&& chmod u+x /tmp/cmake-install.sh \
&& mkdir /opt/cmake-3.31.3 \
&& /tmp/cmake-install.sh --skip-license --prefix=/opt/cmake-3.31.3 \
&& rm /tmp/cmake-install.sh \
&& ln -s /opt/cmake-3.31.3/bin/* /usr/local/bin
ARG CUDA_ARCHITECTURES="86"
# Build and install GLOMAP.
RUN git clone https://github.com/colmap/glomap.git && \
cd glomap && \
git checkout "1.0.0" && \
mkdir build && \
cd build && \
mkdir -p /build && \
cmake .. -GNinja "-DCMAKE_CUDA_ARCHITECTURES=${CUDA_ARCHITECTURES}" \
-DCMAKE_INSTALL_PREFIX=/build/glomap && \
ninja install -j1 && \
cd ~
# Build and install COLMAP.
RUN git clone https://github.com/colmap/colmap.git && \
cd colmap && \
git checkout "3.9.1" && \
mkdir build && \
cd build && \
mkdir -p /build && \
cmake .. -GNinja "-DCMAKE_CUDA_ARCHITECTURES=${CUDA_ARCHITECTURES}" \
-DCMAKE_INSTALL_PREFIX=/build/colmap && \
ninja install -j1 && \
cd ~
# Upgrade pip and install dependencies.
RUN pip install --no-cache-dir --upgrade pip 'setuptools<70.0.0'
RUN export TORCH_CUDA_ARCH_LIST="$(echo "$CUDA_ARCHITECTURES" | tr ';' '\n' | awk '$0 > 70 {print substr($0,1,1)"."substr($0,2)}' | tr '\n' ' ' | sed 's/ $//')" && \
export MAX_JOBS=4 && \
pip install --no-cache-dir flash-attn --no-build-isolation
# Install torch_scatter from github source
RUN export TORCH_CUDA_ARCH_LIST="$(echo "$CUDA_ARCHITECTURES" | tr ';' '\n' | awk '$0 > 70 {print substr($0,1,1)"."substr($0,2)}' | tr '\n' ' ' | sed 's/ $//')" && \
pip install --no-cache-dir git+https://github.com/rusty1s/pytorch_scatter.git
RUN pip install --no-cache-dir \
"jaxtyping>=0.2" \
"torchinfo>=1.8" \
"warp-lang>=1.2" \
"webdataset>=0.2" \
pre-commit \
black \
isort \
flake8 \
build \
"setuptools-scm<10" \
pybind11 \
ipdb \
pytest \
rich \
h5py \
gdown \
wandb \
hydra-core \
omegaconf \
lightning \
torchmetrics \
cupy-cuda12x \
matplotlib \
plotly \
scikit-image \
jupyter
# Install warpconvnet and install only the 3rdparty/cutlass submodule
RUN mkdir -p /opt/warpconvnet && cd /opt/warpconvnet && \
git clone https://github.com/NVlabs/WarpConvNet.git && \
cd WarpConvNet && \
git submodule update --init 3rdparty/cutlass && \
export TORCH_CUDA_ARCH_LIST="$(echo "$CUDA_ARCHITECTURES" | tr ';' '\n' | awk '$0 > 70 {print substr($0,1,1)"."substr($0,2)}' | tr '\n' ' ' | sed 's/ $//')" && \
python -m build --wheel --no-isolation && \
pip install dist/*.whl
RUN git clone --branch master --recursive https://github.com/cvg/Hierarchical-Localization.git /opt/hloc && \
cd /opt/hloc && git checkout v1.4 && python -m pip install --no-cache-dir . && cd ~ && \
TCNN_CUDA_ARCHITECTURES="${CUDA_ARCHITECTURES}" pip install --no-cache-dir --no-build-isolation "git+https://github.com/NVlabs/tiny-cuda-nn.git@b3473c81396fe927293bdfd5a6be32df8769927c#subdirectory=bindings/torch" && \
pip install --no-cache-dir pycolmap==0.6.1 pyceres==2.1 omegaconf==2.3.0
# Install gsplat and nerfstudio.
# NOTE: both are installed jointly in order to prevent docker cache with latest
# gsplat version (we do not expliticly specify the commit hash).
#
# We set MAX_JOBS to reduce resource usage for GH actions:
# - https://github.com/nerfstudio-project/gsplat/blob/db444b904976d6e01e79b736dd89a1070b0ee1d0/setup.py#L13-L23
RUN export TORCH_CUDA_ARCH_LIST="$(echo "$CUDA_ARCHITECTURES" | tr ';' '\n' | awk '$0 > 70 {print substr($0,1,1)"."substr($0,2)}' | tr '\n' ' ' | sed 's/ $//')" && \
export MAX_JOBS=4 && \
pip install --no-cache-dir --no-build-isolation git+https://github.com/nerfstudio-project/gsplat.git@v1.4.0 && \
pip install --no-cache-dir git+https://github.com/nerfstudio-project/nerfstudio@v1.1.5 'numpy<2.0.0' && \
rm -rf /tmp/nerfstudio
RUN pip install --no-cache-dir --force-reinstall --no-deps \
--no-index --find-links https://data.pyg.org/whl/torch-2.5.1+cu121.html \
torch-scatter && \
pip install --no-cache-dir --force-reinstall --no-deps \
opencv-python==4.10.0.84 \
"cupy-cuda12x<14" \
fastrlock
# Add a non-root user with a fixed UID and GID.
ARG USERNAME=user
ARG USER_UID=1000
ARG USER_GID=$USER_UID
RUN set -eux; \
groupadd --gid $USER_GID $USERNAME; \
useradd --uid $USER_UID --gid $USER_GID --no-log-init -m -G video $USERNAME
USER ${USERNAME}
WORKDIR /app
ENV PATH="/build/colmap/bin:/build/glomap/bin:${PATH}"
ENV WARPCONVNET_FWD_ALGO_MODE="[explicit_gemm,implicit_gemm]"
ENV WARPCONVNET_BWD_ALGO_MODE="[explicit_gemm,implicit_gemm]"
CMD ["jupyter", "lab", "--ip=0.0.0.0", "--port=8888", "--no-browser"]