Skip to content

Instantly share code, notes, and snippets.

@greenbrettmichael
Last active November 29, 2025 20:23
Show Gist options
  • Select an option

  • Save greenbrettmichael/942fab33e5056c4cf4e0cc3e0fef8e60 to your computer and use it in GitHub Desktop.

Select an option

Save greenbrettmichael/942fab33e5056c4cf4e0cc3e0fef8e60 to your computer and use it in GitHub Desktop.
Building Colmap and Glomap with CUDA support

This is a bit fragile and hacky to setup at the moment. Two things should happen to improve this configuration process

  1. CMAKE improvements to finding CuDSS. Alternatively, it would be easy enough to write a FindCuDSS.cmake for ceres that looks in standard install locations.
  2. Release of Ceres 2.3. Glomap is dependent on Ceres 2.3 for GPU support, however this version does not have an official release. It would be straightforward to update the official vcpkg port once the version is released.

When using colmap or glomap mappers for bundle adjustment, you may see the error: Requested to use GPU for bundle adjustment, but Ceres was compiled without cuDSS support. Falling back to CPU-based sparse solvers.

This is because Ceres 2.3 is not configured to use cuDSS. I want to share what steps I used to resolve this issue in Ubuntu 24.04.

Prerequisites: Obviously you need to have cuda toolkit and cuDSS installed! I used cuda toolkit 12.6.3 https://developer.nvidia.com/cuda-12-6-3-download-archive and cuDSS 0.5.0 https://developer.nvidia.com/cudss-downloads . I am sure the version is not terribly important, and that newer minor versions will work. I just used nvidia's installation instructions listed on the download page.

You should have all the normal development packages. The apt packages listed in the colmap installation instructions are a super-set of what is needed https://colmap.github.io/install.html . I recommend using the nvidia site instructions and not using the nvidia-cuda-toolkit package.

sudo apt-get install \
    git \
    cmake \
    ninja-build \
    build-essential \
    libboost-program-options-dev \
    libboost-graph-dev \
    libboost-system-dev \
    libeigen3-dev \
    libflann-dev \
    libfreeimage-dev \
    libmetis-dev \
    libgoogle-glog-dev \
    libgtest-dev \
    libgmock-dev \
    libsqlite3-dev \
    libglew-dev \
    qtbase5-dev \
    libqt5opengl5-dev \
    libcgal-dev \
    libceres-dev

I used the Ubuntu 24.04 default gcc 13.3.0 . If you use a different cuda toolkit, you will need to use a compatible gcc version. That is the reason why the colmap install instructions instruct to use gcc 10 for Ubuntu 22, because Ubuntu 22 nvidia-cuda-toolkit defaults to a version that does not support gcc 11, which is the default gcc for Ubuntu 22.

Build Steps: These are the build steps I followed. These steps assume that a global installation in /usr/local is acceptable. If it is not, I would encourage using a package management solution like vcpkg.

You need to build ceres, colmap, and finally glomap from source.

ceres 2.3

git clone --recurse-submodules -j8 https://github.com/ceres-solver/ceres-solver
git checkout 46b4b3b002994ddb9d6fc72268c3e271243cd1df
cd ceres-solver
mkdir build
cd build
cmake ..
make -j 8
sudo make install

notes about ceres: The output of the command "cmake .." should contain something like "found cudss". If it does not, then something has gone wrong, and BA will not use the GPU. Go back through the other steps if you don't see this. You do not need to override the cudss_dir cmake variable, the nvidia package will provide a cmake configuration file at /usr/lib/x86_64-linux-gnu/libcudss/12/cmake/cudss that will allow cmake to find it. The ceres cmake configuration will attempt to find the package using the well supported cmake path mechanism, if that isn't working you will want to figure out why so you don't have upstream configuration problems.

Also, ceres 2.3 is an unreleased development version. The commit used is the ~HEAD at time of writing. It is possible that future commits will work, but you cannot use commits before the 2.2 tag. The colmap and glomap code check the ceres version number.

colmap 3.11.1

git clone https://github.com/colmap/colmap.git
git checkout 682ea9ac4020a143047758739259b3ff04dabe8d
cd colmap
mkdir build
cd build
cmake .. -GNinja
ninja
sudo ninja install

glomap

git clone https://github.com/colmap/glomap.git
git checkout 262e122da0bedf2f48ec4735f84c93127862b2a1
cd glomap
mkdir build
cd build
cmake .. -GNinja
ninja
sudo ninja install

notes about glomap: The checkout SHA is not very important, this is just ~HEAD and what I was successful with.

in your clone of glomap, customize vcpkg using the instructions provided here colmap/colmap#3163

mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -DTESTS_ENABLED=ON -DCUDA_ENABLED=ON -DGUI_ENABLED=OFF -DCGAL_ENABLED=OFF -DCMAKE_CUDA_ARCHITECTURES=all-major -DCMAKE_TOOLCHAIN_FILE="../vcpkg/scripts/buildsystems/vcpkg.cmake" -DVCPKG_TARGET_TRIPLET=x64-windows-release -DCMAKE_INSTALL_PREFIX=install
cmake --build . --config release --parallel 24
cmake --install . --prefix "install"
../vcpkg/vcpkg.exe install --triplet=x64-windows-release --x-feature=cuda 
../vcpkg/vcpkg.exe export --raw --output-dir vcpkg_export --output glomap
cp vcpkg_export/glomap/installed/x64-windows/bin/*.dll install/bin
cp vcpkg_export/glomap/installed/x64-windows-release/bin/*.dll install/bin
cp "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.4\bin\cudart64_*.dll" install/bin
cp "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.4\bin\curand64_*.dll" install/bin
cp "C:\Program Files\NVIDIA cuDSS\v0.5\bin\12\*.dll" install/bin
@greenbrettmichael
Copy link
Author

What version of boost did you use? I have tested it with boost==1.87 but it failed. Boost 1.85.0 worked well..

1.74.0
boost is installed from the apt package when adding dependencies listed on the colmap website
https://colmap.github.io/install.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment