From f2beea4d50116ffea64f371ebef513c2d2639b32 Mon Sep 17 00:00:00 2001 From: Mihai Dusmanu Date: Wed, 8 Oct 2025 17:49:13 +0200 Subject: [PATCH 1/7] Fix. --- Dockerfile | 7 +++---- scripts/build_pcdmeshing.sh | 9 +++++++-- scripts/build_raybender.sh | 8 ++++++-- scripts/install_ceres_solver.sh | 5 ++--- scripts/install_colmap.sh | 2 +- scripts/install_core_dependencies.sh | 4 ++-- scripts/install_hloc.sh | 4 ++-- 7 files changed, 23 insertions(+), 16 deletions(-) diff --git a/Dockerfile b/Dockerfile index ead5864..c005640 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,4 @@ -ARG UBUNTU_VERSION=22.04 -FROM mcr.microsoft.com/mirror/docker/library/ubuntu:${UBUNTU_VERSION} AS common +FROM runpod/pytorch:1.0.1-cu1281-torch280-ubuntu2404 AS common # Minimal toolings. RUN apt-get update && \ @@ -110,7 +109,7 @@ RUN cd pyceres && \ # # pyceres stage. # -FROM scantools as pyceres +FROM scantools AS pyceres # Install minimal runtime dependencies. RUN apt-get update && \ @@ -135,7 +134,7 @@ RUN rm -rfv /tmp/* # # lamar stage. # -FROM pyceres as lamar +FROM pyceres AS lamar # Install hloc. COPY scripts/install_hloc.sh /tmp/ diff --git a/scripts/build_pcdmeshing.sh b/scripts/build_pcdmeshing.sh index 8965272..c7f1a9f 100755 --- a/scripts/build_pcdmeshing.sh +++ b/scripts/build_pcdmeshing.sh @@ -1,13 +1,18 @@ #!/usr/bin/env bash -root_folder=$(realpath $(dirname "$(readlink -f "${BASH_SOURCE[0]}")")/..) -source ${root_folder}/scripts/load_env.sh +PS4='\033[0;32m$(date "+%Y%m%d %H:%M:%S.%N") $BASH_SOURCE:$LINENO]\033[0m ' +set -euxo pipefail sudo apt-get install -y --no-install-recommends --no-install-suggests \ libboost-dev libgmp3-dev libmpfrc++-dev git clone --recursive https://github.com/cvg/pcdmeshing.git --depth=1 cd pcdmeshing +cd pybind11 +git fetch --tags +git checkout v2.13.6 +cd .. + # Build the wheel. pip wheel --no-deps -w dist-wheel . whl_path=$(find dist-wheel/ -name "*.whl") diff --git a/scripts/build_raybender.sh b/scripts/build_raybender.sh index 0f60761..edd56a8 100755 --- a/scripts/build_raybender.sh +++ b/scripts/build_raybender.sh @@ -1,12 +1,16 @@ #!/usr/bin/env bash -root_folder=$(realpath $(dirname "$(readlink -f "${BASH_SOURCE[0]}")")/..) -source ${root_folder}/scripts/load_env.sh +PS4='\033[0;32m$(date "+%Y%m%d %H:%M:%S.%N") $BASH_SOURCE:$LINENO]\033[0m ' +set -euxo pipefail # Clone raybender. git clone --recursive https://github.com/cvg/raybender.git --depth=1 cd raybender +cd pybind11 +git pull +cd .. + # Install Embree following the official instructions and set the environmental # variable embree_DIR to point to embree-config.cmake. On Linux, this can be # done as follows: diff --git a/scripts/install_ceres_solver.sh b/scripts/install_ceres_solver.sh index 560438d..3d2e99b 100755 --- a/scripts/install_ceres_solver.sh +++ b/scripts/install_ceres_solver.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash -root_folder=$(realpath $(dirname "$(readlink -f "${BASH_SOURCE[0]}")")/..) -source ${root_folder}/scripts/load_env.sh +PS4='\033[0;32m$(date "+%Y%m%d %H:%M:%S.%N") $BASH_SOURCE:$LINENO]\033[0m ' +set -euxo pipefail apt-get install -y --no-install-recommends --no-install-suggests \ cmake \ @@ -9,7 +9,6 @@ apt-get install -y --no-install-recommends --no-install-suggests \ libgflags-dev \ libatlas-base-dev \ libeigen3-dev \ - libsuitesparse-dev \ build-essential git clone -b 2.1.0 https://github.com/ceres-solver/ceres-solver.git ceres-solver-v2.1.0 --depth=1 diff --git a/scripts/install_colmap.sh b/scripts/install_colmap.sh index 8a82dd1..cec7e78 100755 --- a/scripts/install_colmap.sh +++ b/scripts/install_colmap.sh @@ -24,5 +24,5 @@ apt-get install -y --no-install-recommends --no-install-suggests \ # Installing COLMAP version 3.8 git clone --recursive -b 3.8 https://github.com/colmap/colmap colmap_v3.8 --depth=1 cd colmap_v3.8 -cmake -S . -B build -DCMAKE_CUDA_ARCHITECTURES=all +cmake -S . -B build -DCUDA_ENABLED=False cmake --build build --target install -- -j$(nproc) diff --git a/scripts/install_core_dependencies.sh b/scripts/install_core_dependencies.sh index 435f031..e2c8291 100755 --- a/scripts/install_core_dependencies.sh +++ b/scripts/install_core_dependencies.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash -root_folder=$(realpath $(dirname "$(readlink -f "${BASH_SOURCE[0]}")")/..) -source ${root_folder}/scripts/load_env.sh +PS4='\033[0;32m$(date "+%Y%m%d %H:%M:%S.%N") $BASH_SOURCE:$LINENO]\033[0m ' +set -euxo pipefail # Uncomment the following line if you want to use this script inside Docker. # apt-get update && apt-get install -y --no-install-recommends --no-install-suggests git python3 python3-dev python3-pip python-is-python3 sudo diff --git a/scripts/install_hloc.sh b/scripts/install_hloc.sh index 65399a3..5c742e1 100755 --- a/scripts/install_hloc.sh +++ b/scripts/install_hloc.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash -root_folder=$(realpath $(dirname "$(readlink -f "${BASH_SOURCE[0]}")")/..) -source ${root_folder}/scripts/load_env.sh +PS4='\033[0;32m$(date "+%Y%m%d %H:%M:%S.%N") $BASH_SOURCE:$LINENO]\033[0m ' +set -euxo pipefail git clone --recursive -b v1.4 https://github.com/cvg/Hierarchical-Localization/ hloc --depth=1 cd hloc From 5089452b2e450fe29e972fe0bac1407ec90a9071 Mon Sep 17 00:00:00 2001 From: Mihai Dusmanu Date: Wed, 8 Oct 2025 18:14:15 +0200 Subject: [PATCH 2/7] Fix. --- scripts/build_raybender.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/build_raybender.sh b/scripts/build_raybender.sh index edd56a8..5d31fe8 100755 --- a/scripts/build_raybender.sh +++ b/scripts/build_raybender.sh @@ -8,7 +8,8 @@ git clone --recursive https://github.com/cvg/raybender.git --depth=1 cd raybender cd pybind11 -git pull +git fetch --tags +git checkout v2.13.6 cd .. # Install Embree following the official instructions and set the environmental From 98fdd5e4128cfb80395b7ed5e9bfc30bdb3910bc Mon Sep 17 00:00:00 2001 From: Mihai Dusmanu Date: Wed, 8 Oct 2025 23:03:51 +0200 Subject: [PATCH 3/7] More fixes. --- Dockerfile | 45 ++++++++++++++++++++++++++++----------------- 1 file changed, 28 insertions(+), 17 deletions(-) diff --git a/Dockerfile b/Dockerfile index c005640..2f9d414 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,10 @@ FROM runpod/pytorch:1.0.1-cu1281-torch280-ubuntu2404 AS common +# To avoid compiler segfault when building the image on ARM. +ENV CFLAGS="-fno-lto" +ENV CXXFLAGS="-fno-lto" +ENV LDFLAGS="-fno-lto" + # Minimal toolings. RUN apt-get update && \ apt-get install -y --no-install-recommends --no-install-suggests \ @@ -54,21 +59,21 @@ RUN apt-get update && \ # Install raybender. COPY --from=builder /raybender/embree-3.12.2/lib /raybender/embree-3.12.2/lib COPY --from=builder /raybender/dist-wheel /tmp/dist-wheel -RUN cd /tmp && whl_path=$(cat dist-wheel/whl_path.txt) && python3 -m pip install $whl_path +RUN cd /tmp && whl_path=$(cat dist-wheel/whl_path.txt) && python3 -m pip install --ignore-installed $whl_path RUN rm -rfv /tmp/* # Install pcdmeshing. COPY --from=builder /pcdmeshing/dist-wheel /tmp/dist-wheel RUN apt-get install -y --no-install-recommends --no-install-suggests libmpfrc++-dev -RUN cd /tmp && whl_path=$(cat dist-wheel/whl_path.txt) && python3 -m pip install $whl_path +RUN cd /tmp && whl_path=$(cat dist-wheel/whl_path.txt) && python3 -m pip install --ignore-installed $whl_path RUN rm -rfv /tmp/* -RUN python3 -m pip install --no-deps \ +RUN python3 -m pip install --ignore-installed --no-deps \ astral==3.2 \ beautifulsoup4==4.12.2 \ - lxml==4.9.2 \ + lxml==5.3.0 \ matplotlib \ - open3d==0.18.0 \ + open3d==0.19.0 \ opencv-python==4.7.0.72 \ plyfile==1.0.3 \ pytijo==0.0.2 \ @@ -101,27 +106,28 @@ RUN bash /tmp/install_colmap.sh RUN git clone --depth 1 -b v1.0 --recursive https://github.com/cvg/pyceres RUN python3 -m pip install --upgrade pip RUN apt-get install -y --no-install-recommends --no-install-suggests python3-dev +RUN cd pyceres/pybind11 && \ + git fetch --tags && \ + git checkout v2.13.6 RUN cd pyceres && \ pip wheel . --no-deps -w dist-wheel -vv && \ whl_path=$(find dist-wheel/ -name "*.whl") && \ echo $whl_path >dist-wheel/whl_path.txt +RUN git clone --depth=1 -b --recursive v0.4.0 https://github.com/colmap/pycolmap pycolmap +RUN cd pycolmap/pybind11 && \ + git fetch --tags && \ + git checkout v2.13.6 +RUN cd pycolmap && \ + pip wheel . --no-deps -w dist-wheel -vv && \ + whl_path=$(find dist-wheel/ -name "*.whl") && \ + echo $whl_path >dist-wheel/whl_path.txt + # # pyceres stage. # FROM scantools AS pyceres -# Install minimal runtime dependencies. -RUN apt-get update && \ - apt-get install -y --no-install-recommends --no-install-suggests \ - libgoogle-glog0v5 \ - libspqr2 \ - libcxsparse3 \ - libatlas3-base \ - python-is-python3 \ - python3-minimal \ - python3-pip - # Copy installed libraries in the builder stage. COPY --from=pyceres-builder /usr/local/ /usr/local/ @@ -131,6 +137,12 @@ RUN pip install --upgrade pip RUN cd /tmp && whl_path=$(cat dist-wheel/whl_path.txt) && pip install $whl_path RUN rm -rfv /tmp/* +# Install pycolmap. +COPY --from=pyceres-builder /pycolmap/dist-wheel /tmp/dist-wheel +RUN pip install --upgrade pip +RUN cd /tmp && whl_path=$(cat dist-wheel/whl_path.txt) && pip install $whl_path +RUN rm -rfv /tmp/* + # # lamar stage. # @@ -149,7 +161,6 @@ RUN python3 -m pip install --no-deps \ numpy==1.26.3 \ torch>=1.1 \ tqdm>=4.36.0 \ - pycolmap==0.4.0 \ scikit-learn==1.5.2 RUN cd /lamar && python3 -m pip install -e . --no-deps From dd117f6540d35a6135181ef930af3224374c0311 Mon Sep 17 00:00:00 2001 From: Mihai Dusmanu Date: Thu, 9 Oct 2025 10:18:37 +0200 Subject: [PATCH 4/7] Fix. --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 2f9d414..1a26264 100644 --- a/Dockerfile +++ b/Dockerfile @@ -114,7 +114,7 @@ RUN cd pyceres && \ whl_path=$(find dist-wheel/ -name "*.whl") && \ echo $whl_path >dist-wheel/whl_path.txt -RUN git clone --depth=1 -b --recursive v0.4.0 https://github.com/colmap/pycolmap pycolmap +RUN git clone --depth=1 -b v0.4.0 --recursive https://github.com/colmap/pycolmap pycolmap RUN cd pycolmap/pybind11 && \ git fetch --tags && \ git checkout v2.13.6 From 50dcb6eceb88da0d0a34dc45d50e301b7650699e Mon Sep 17 00:00:00 2001 From: Mihai Dusmanu Date: Thu, 9 Oct 2025 14:00:55 +0200 Subject: [PATCH 5/7] F. --- Dockerfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 1a26264..bfae1fb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,9 @@ FROM runpod/pytorch:1.0.1-cu1281-torch280-ubuntu2404 AS common # To avoid compiler segfault when building the image on ARM. -ENV CFLAGS="-fno-lto" -ENV CXXFLAGS="-fno-lto" -ENV LDFLAGS="-fno-lto" +# ENV CFLAGS="-fno-lto" +# ENV CXXFLAGS="-fno-lto" +# ENV LDFLAGS="-fno-lto" # Minimal toolings. RUN apt-get update && \ From a13b0e5152daee429604540d3164ee122a51681b Mon Sep 17 00:00:00 2001 From: Mihai Dusmanu Date: Thu, 9 Oct 2025 14:10:36 +0200 Subject: [PATCH 6/7] Fix. --- .github/workflows/docker-image.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index db2491d..0f09359 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -27,6 +27,7 @@ jobs: - name: Build and push Scantools Docker image run: | DATE=$(date +%Y-%m-%d) + docker system prune -a --volumes --force docker build . --tag ghcr.io/microsoft/lamar-benchmark/scantools:$DATE --target scantools if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then docker tag ghcr.io/microsoft/lamar-benchmark/scantools:$DATE \ @@ -38,6 +39,7 @@ jobs: - name: Build and push Lamar Docker image run: | DATE=$(date +%Y-%m-%d) + docker system prune -a --volumes --force docker build . --tag ghcr.io/microsoft/lamar-benchmark/lamar:$DATE --target lamar if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then docker tag ghcr.io/microsoft/lamar-benchmark/lamar:$DATE \ From 3861eade51e5918a997fb6fd605c4128856c4523 Mon Sep 17 00:00:00 2001 From: Mihai Dusmanu Date: Thu, 9 Oct 2025 14:14:11 +0200 Subject: [PATCH 7/7] larger machine. --- .github/workflows/docker-image.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 0f09359..03387de 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -9,7 +9,7 @@ on: jobs: build-and-push: permissions: write-all - runs-on: ubuntu-latest + runs-on: ubuntu-latest-4-cores steps: - name: Checkout uses: actions/checkout@v4 @@ -27,7 +27,6 @@ jobs: - name: Build and push Scantools Docker image run: | DATE=$(date +%Y-%m-%d) - docker system prune -a --volumes --force docker build . --tag ghcr.io/microsoft/lamar-benchmark/scantools:$DATE --target scantools if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then docker tag ghcr.io/microsoft/lamar-benchmark/scantools:$DATE \ @@ -39,7 +38,6 @@ jobs: - name: Build and push Lamar Docker image run: | DATE=$(date +%Y-%m-%d) - docker system prune -a --volumes --force docker build . --tag ghcr.io/microsoft/lamar-benchmark/lamar:$DATE --target lamar if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then docker tag ghcr.io/microsoft/lamar-benchmark/lamar:$DATE \