Skip to content
Merged
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
101 changes: 76 additions & 25 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,47 +1,78 @@
FROM nvidia/cuda:12.4.1-cudnn-devel-ubuntu22.04 AS builder
FROM nvidia/cuda:12.9.1-devel-ubuntu24.04 AS builder

WORKDIR /workspace

ENV DEBIAN_FRONTEND=noninteractive

ENV PYTHON_VERSION=3.13.12

# needed to install the CUDA version of PyTorch3D
# see https://github.com/facebookresearch/pytorch3d/blob/main/INSTALL.md
# see https://github.com/pytorch/extension-cpp/issues/71
ENV FORCE_CUDA=1
ENV TORCH_CUDA_ARCH_LIST="5.0;6.0;6.1;7.0;7.5;8.0;8.6+PTX"

RUN apt-get update && apt-get install -y --no-install-recommends git lsb-release software-properties-common wget
RUN apt-get update && apt-get upgrade -y && apt-get install -y --no-install-recommends \
curl \
git \
g++ \
gnupg \
libatomic1 \
libegl1 \
libbz2-dev \
libffi-dev \
libgl1 \
libgomp1 \
liblzma-dev \
lsb-release \
libssl-dev \
libx11-xcb1 \
make \
software-properties-common \
tzdata \
unzip \
wget \
zlib1g-dev \
&& rm -rf /var/lib/apt/lists/*

######################## Python installation #########################

RUN apt-get install -y --no-install-recommends python3.11-dev python3.11-distutils python3.11-venv
# Download Python source code from official site and build it
RUN wget https://www.python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHON_VERSION.tgz && \
tar -zxvf Python-$PYTHON_VERSION.tgz && \
cd Python-$PYTHON_VERSION && \
./configure --enable-optimizations && make && make install && \
cd .. && \
rm Python-$PYTHON_VERSION.tgz && \
rm -r Python-$PYTHON_VERSION

RUN wget https://bootstrap.pypa.io/get-pip.py -O get-pip.py
RUN python3.11 get-pip.py && python3.11 -m pip install --upgrade pip

#################### Create Virtual Environment ######################

ENV VIRTUAL_ENV=/workspace/venv
RUN python3.11 -m venv $VIRTUAL_ENV
RUN python3.13 -m venv $VIRTUAL_ENV

# by adding the venv to the search path, we avoid activating it in each command
# see https://pythonspeed.com/articles/activate-virtualenv-dockerfile/
ENV PATH="$VIRTUAL_ENV/bin:$PATH"

# install pip into venv
RUN python get-pip.py && python -m pip install --upgrade pip

######## Install PyTorch and packages that depend on PyTorch #########

# these packages are dependencies of the other packages but not listed in their requirements
# therefore, they have to be installed manually
RUN python -m pip install tensorboard yapf wheel packaging
RUN python -m pip install torch==2.4.1 torchvision==0.19.1 torchaudio==2.4.1 --index-url https://download.pytorch.org/whl/cu124
RUN python -m pip install torch-scatter==2.1.2 -f https://data.pyg.org/whl/torch-2.4.1+cu124.html
RUN python -m pip install torch-cluster==1.6.3 -f https://data.pyg.org/whl/torch-2.4.1+cu124.html
RUN python -m pip install "git+https://github.com/facebookresearch/pytorch3d.git@stable"
RUN python -m pip install torch==2.10.0 torchvision==0.25.0 torchaudio==2.10.0 --index-url https://download.pytorch.org/whl/cu129
RUN python -m pip install torch-scatter torch-cluster -f https://data.pyg.org/whl/torch-2.10.0+cu128.html
Comment thread
josafatburmeister marked this conversation as resolved.
RUN python -m pip install --no-build-isolation "git+https://github.com/facebookresearch/pytorch3d.git@stable"
RUN python -m pip install spconv-cu124
RUN python -m pip install flash-attn --no-build-isolation
RUN python -m pip install --extra-index-url=https://pypi.nvidia.com "cuml-cu12==25.6.*"
RUN pip install https://github.com/mjun0812/flash-attention-prebuild-wheels/releases/download/v0.7.16/flash_attn-2.8.3%2Bcu128torch2.10-cp313-cp313-linux_x86_64.whl
RUN python -m pip install --extra-index-url=https://pypi.nvidia.com "cuml-cu12==26.2.*"

# ######################## Open3D build #################################

RUN git clone https://github.com/isl-org/Open3D
RUN git clone https://github.com/isl-org/Open3D-ML.git

Expand All @@ -59,12 +90,12 @@ RUN apt update && apt install kitware-archive-keyring && rm /etc/apt/trusted.gpg
RUN mkdir /workspace/Open3D/build && cd /workspace/Open3D/build && \
cmake -DPYTHON3_INCLUDE_DIR=$(python -c "import sysconfig && print(sysconfig.get_path('include'))") \
-DPYTHON3_LIBRARY=$(python -c "import sysconfig && print(sysconfig.get_config_var('LIBDIR'))") \
-DBUILD_CUDA_MODULE=OFF -DGLIBCXX_USE_CXX11_ABI=OFF -DBUILD_PYTORCH_OPS=ON -DBUILD_TENSORFLOW_OPS=OFF \
-DBUILD_CUDA_MODULE=OFF -DGLIBCXX_USE_CXX11_ABI=ON -DBUILD_PYTORCH_OPS=ON -DBUILD_TENSORFLOW_OPS=OFF \
-DBUNDLE_OPEN3D_ML=ON -DOPEN3D_ML_ROOT=/workspace/Open3D-ML .. && \
make -j$(nproc) && \
cmake -DPYTHON3_INCLUDE_DIR=$(python -c "import sysconfig && print(sysconfig.get_path('include'))") \
-DPYTHON3_LIBRARY=$(python -c "import sysconfig && print(sysconfig.get_config_var('LIBDIR'))") \
-DBUILD_CUDA_MODULE=ON -DGLIBCXX_USE_CXX11_ABI=OFF -DBUILD_PYTORCH_OPS=ON -DBUILD_TENSORFLOW_OPS=OFF \
-DBUILD_CUDA_MODULE=ON -DGLIBCXX_USE_CXX11_ABI=ON -DBUILD_PYTORCH_OPS=ON -DBUILD_TENSORFLOW_OPS=OFF \
-DBUNDLE_OPEN3D_ML=ON -DOPEN3D_ML_ROOT=/workspace/Open3D-ML .. && \
make -j$(nproc) && \
make install-pip-package
Expand All @@ -76,21 +107,36 @@ RUN python -m pip uninstall -y yapf wheel packaging
######################### Target Image #############################
####################################################################

FROM nvidia/cuda:12.4.1-cudnn-runtime-ubuntu22.04
FROM nvidia/cuda:12.9.1-runtime-ubuntu24.04

ENV DEBIAN_FRONTEND=noninteractive

WORKDIR /workspace
ENV PYTHON_VERSION=3.13.12

# include packages needed for the rclone installation / as runtime dependencies of Open3D
RUN apt-get update && apt-get install -y --no-install-recommends \
curl git gnupg make unzip libegl1 libgl1 libgomp1 libx11-xcb1 libatomic1 g++

######################## Python installation ########################
WORKDIR /workspace

RUN apt-get update && apt-get install -y --no-install-recommends wget python3.11-dev python3.11-distutils python3.11-venv
RUN wget https://bootstrap.pypa.io/get-pip.py -O get-pip.py
RUN python3.11 get-pip.py && python3.11 -m pip install --upgrade pip
RUN apt-get update && apt-get upgrade -y && apt-get install -y --no-install-recommends \
curl \
git \
g++ \
gnupg \
libatomic1 \
libegl1 \
libbz2-dev \
libffi-dev \
libgl1 \
libgomp1 \
liblzma-dev \
lsb-release \
libssl-dev \
libx11-xcb1 \
make \
software-properties-common \
tzdata \
unzip \
wget \
zlib1g-dev \
&& rm -rf /var/lib/apt/lists/*

######################## Rclone installation ########################

Expand All @@ -109,6 +155,11 @@ COPY --from=builder /usr/lib/x86_64-linux-gnu/libGL.so.1 /usr/lib/x86_64-linux-g
COPY --from=builder /usr/lib/x86_64-linux-gnu/libGLdispatch.so.0 /usr/lib/x86_64-linux-gnu/libGLdispatch.so.0
COPY --from=builder /usr/lib/x86_64-linux-gnu/libGLX.so.0 /usr/lib/x86_64-linux-gnu/libGLX.so.0

# copy python installation to avoid building python twice
COPY --from=builder /usr/local/bin/python3.13 /usr/local/bin/python3.13
COPY --from=builder /usr/local/lib/python3.13 /usr/local/lib/python3.13
COPY --from=builder /usr/local/include/python3.13 /usr/local/include/python3.13

RUN mkdir pointtorch
ADD . pointtorch
RUN python -m pip install ./pointtorch[dev,docs]
RUN python -m pip install ./pointtorch[dev,docs]
Loading