diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index db2491d..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 diff --git a/Dockerfile b/Dockerfile index ead5864..bfae1fb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,9 @@ -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 + +# 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 && \ @@ -55,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 \ @@ -102,26 +106,27 @@ 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 v0.4.0 --recursive 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 +FROM scantools AS pyceres # Copy installed libraries in the builder stage. COPY --from=pyceres-builder /usr/local/ /usr/local/ @@ -132,10 +137,16 @@ 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. # -FROM pyceres as lamar +FROM pyceres AS lamar # Install hloc. COPY scripts/install_hloc.sh /tmp/ @@ -150,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 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..5d31fe8 100755 --- a/scripts/build_raybender.sh +++ b/scripts/build_raybender.sh @@ -1,12 +1,17 @@ #!/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 fetch --tags +git checkout v2.13.6 +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