From c8bb32773ef393d7bc6b8ffc18474fff11f34216 Mon Sep 17 00:00:00 2001 From: yubbit Date: Thu, 15 Jan 2026 23:58:06 +0800 Subject: [PATCH] Compile Ceres to support cuDSS --- colmap/Dockerfile | 43 ++++++++++++++++++++++++++++++++++++------- 1 file changed, 36 insertions(+), 7 deletions(-) diff --git a/colmap/Dockerfile b/colmap/Dockerfile index 066f116..09d1f3c 100644 --- a/colmap/Dockerfile +++ b/colmap/Dockerfile @@ -36,10 +36,29 @@ RUN apt-get update && \ libqt6opengl6-dev \ libqt6openglwidgets6 \ libcgal-dev \ - libceres-dev \ libcurl4-openssl-dev \ libssl-dev \ - libmkl-full-dev + libmkl-full-dev \ + libsuitesparse-dev \ + libcudss0-dev-cuda-12 \ + libcudss0-static-cuda-12 + +# Install Ceres Solver with CUDA support. Disable testing and examples since +# the GPU isn't available to us at build time +RUN git clone --recursive https://github.com/ceres-solver/ceres-solver +RUN mkdir ceres-bin && \ + cd ceres-bin && \ + cmake ../ceres-solver \ + -DUSE_CUDA=ON \ + -DCMAKE_CUDA_ARCHITECTURES=${CUDA_ARCHITECTURES} \ + -DBUILD_TESTING=OFF \ + -DBUILD_EXAMPLES=OFF \ + -DCMAKE_BUILD_TYPE=Release \ + -Dcudss_DIR=/usr/lib/x86_64-linux-gnu/libcudss/12/cmake/cudss \ + -Dcudss_INCLUDE_DIR=/usr/include/libcudss/12 && \ + make -j8 && \ + make test && \ + make install # Fix issue in Ubuntu's openimageio CMake config. # We don't depend on any of openimageio's OpenCV functionality, @@ -47,7 +66,7 @@ RUN apt-get update && \ RUN mkdir -p /usr/include/opencv4 # Build and install COLMAP. -RUN git clone https://github.com/colmap/colmap.git +RUN git clone --recursive https://github.com/colmap/colmap.git RUN cd colmap && \ git fetch https://github.com/colmap/colmap.git ${COLMAP_GIT_COMMIT} && \ git checkout FETCH_HEAD && \ @@ -57,7 +76,9 @@ RUN cd colmap && \ -GNinja \ -DCMAKE_CUDA_ARCHITECTURES=${CUDA_ARCHITECTURES} \ -DCMAKE_INSTALL_PREFIX=/colmap-install \ - -DBLA_VENDOR=Intel10_64lp && \ + -DBLA_VENDOR=Intel10_64lp \ + -Dcudss_DIR=/usr/lib/x86_64-linux-gnu/libcudss/12/cmake/cudss \ + -Dcudss_INCLUDE_DIR=/usr/include/libcudss/12 && \ ninja install # @@ -71,11 +92,12 @@ FROM nvidia/cuda:${NVIDIA_CUDA_VERSION}-runtime-ubuntu${UBUNTU_VERSION} AS runti RUN apt-get update && \ apt-get install -y --no-install-recommends --no-install-suggests \ libboost-program-options1.83.0 \ + libspqr4 \ + libcholmod5 \ libc6 \ libomp5 \ libopengl0 \ libmetis5 \ - libceres4t64 \ libopenimageio2.4t64 \ libgcc-s1 \ libgl1 \ @@ -90,7 +112,8 @@ RUN apt-get update && \ libmkl-locale \ libmkl-intel-lp64 \ libmkl-intel-thread \ - libmkl-core && \ + libmkl-core \ + libcudss0-cuda-12 && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* @@ -100,4 +123,10 @@ RUN apt-get update && \ # of this Docker image to use it as a base image for compiling against COLMAP as # a library. For instance, CMake will be able to find COLMAP easily with the # command: find_package(COLMAP REQUIRED). -COPY --from=builder /colmap-install/ /usr/local/ \ No newline at end of file +COPY --from=builder /colmap-install/ /usr/local/ +COPY --from=builder /usr/local/include/ /usr/local/include/ +COPY --from=builder /usr/local/lib/ /usr/local/lib/ +COPY --from=builder /usr/lib/x86_64-linux-gnu/libcudss /usr/lib/x86_64-linux-gnu/libcudss + +ENV LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/libcudss/12:$LD_LIBRARY_PATH +WORKDIR /workspace