Skip to content

Empty patch match results on CUDA compute >= 100 #3514

Description

@yklcs

Running patch_match_stereo results in a random noise depth map and an empty normal map on CUDA compute >= 100.
No problems on compute_90, but fails on compute_100, compute_120.
Naturally, any succeeding steps fail. There are no indications of any problems in the logs.
The input I am using is a well-established multiview dataset with ~20 views, and I did not have any problems previously. SfM reconstruction works fine.

I am using COLMAP release 3.12.3, built from source on CUDA 12.8 with CMAKE_CUDA_ARCHITECTURES=120.

$ cat /proc/driver/nvidia/version
NVRM version: NVIDIA UNIX Open Kernel Module for x86_64  570.153.02  Release Build  (nixbld@)
GCC version:  gcc version 14.2.1 20250322 (GCC)

$ colmap help | head -n 2
COLMAP 3.12.3 -- Structure-from-Motion and Multi-View Stereo
(Commit Unknown on Unknown with CUDA)

$ uname -a
Linux nixosll 6.15.4 #1-NixOS SMP PREEMPT_DYNAMIC Fri Jun 27 10:13:43 UTC 2025 x86_64 GNU/Linux

$ nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2025 NVIDIA Corporation
Built on Fri_Feb_21_20:23:50_PST_2025
Cuda compilation tools, release 12.8, V12.8.93
Build cuda_12.8.r12.8/compiler.35583870_
Image Image

Activity

  1. changed the title [-]Empty patch match results[/-] [+]Empty patch match results on CUDA compute >= 100[/+] on Jul 30, 2025
  2. dushko-murtovski commented on Sep 9, 2025

    @dushko-murtovski

    Hi,

    Is there a fix or more info about this.
    I have the same result on mobile rtx 5070. It worked before on rtx 3090 and bellow. I tired different combinations on cuda and build compute architecture but with the same result.
    If i try to run the binaries that ware build on different machine on the target rtx 5070 it says that no kernel was build for that device even when the required compute capability is included.

    Any feedback would be appreciated.

    Regards

  3. tfwittwer commented on Feb 25, 2026

    @tfwittwer

    I have the same issue running the pre-built Windows binaries of version 3.13.0 on an RTX 5090, so it is not limited to Linux. However, using a self-compiled 3.14.0.dev0, the depth maps are Ok and the dense reconstruction works.

  4. LeanderFischer commented on Feb 26, 2026

    @LeanderFischer

    self-compiled 3.14.0.dev0

    Could you specify which commit exactly you built? Ah, it's this version, I'll give it a shot now.

    For context: I'm running into the same issue after bulding Colmap LTS 3.13.0 on a DGX Spark with Ubuntu 24.04 and compute capability of 12.1 with Cuda 13.

  5. LeanderFischer commented on Feb 26, 2026

    @LeanderFischer

    Ok, I tried with 868aff9 and also with the current main (65301f4), but no luck. I don't quite understand what the issue is. Some insight from the experts would be nice!

  6. tfwittwer commented on Feb 26, 2026

    @tfwittwer

    I cloned the repository back in November. git log says dd14dc7 as the latest commit. I use Cuda 12.8, which is the oldest version that supports the Blackwell architecture. I don't know though whether this is available on the Spark.

  7. tfwittwer commented on Feb 26, 2026

    @tfwittwer

    Well guess what, I just recompiled COLMAP after adding some debug statements to help me with another issue, and now it doesn't work anymore. I did not clone the most recent version, and nvcc is still version 12.8.93 from February 2025. So something else in the toolchain has changed that causes these issues, or it's the GPU driver.

  8. LeanderFischer commented on Feb 27, 2026

    @LeanderFischer

    I use Cuda 12.8, which is the oldest version that supports the Blackwell architecture. I don't know though whether this is available on the Spark

    For now, I would refrain from messing with the Cuda+Nvidia version combo on the spark 😬 I don't want to break that.

    One other difference between my working setup and the broken setup (on the spark) is that the spark is running their own Ubuntu based OS (24.04), where I couldn't build with MKL, but had to fall back to OpenBLAS. Don't think that's related, but who knows 🤷 My working setup is on 22.04 and uses MKL.

  9. tfwittwer commented on Feb 27, 2026

    @tfwittwer

    Yeah, MKL is x86-only so it won't work on the Spark. I'm also on Ubuntu 24.04, so it might have to do with the underlying toolchain and libraries.

  10. ahojnnes commented on Feb 27, 2026

    @ahojnnes
    Contributor

    I am trying to follow the discussion. Is this an issue related to the specific toolchain or we should treat this as a bug on all platforms?

  11. tfwittwer commented on Feb 27, 2026

    @tfwittwer

    It occurs under Windows, x86 Linux, and ARM Linux, so it looks to me like a bug on all platforms. 3.12.6 produces good results under Windows.

  12. ahojnnes commented on Feb 27, 2026

    @ahojnnes
    Contributor

    Does anybody have a definite commit hash where it still worked correctly?

  13. tfwittwer commented on Feb 27, 2026

    @tfwittwer

    Since the same commit (dd14dc7) in my case worked when compiled back in November, and doesn't when compiled now on an up-to-date Ubuntu 24.04, it doesn't look like there's an older commit that would automatically work when built with a current tool chain. But this is just guessing. The pre-built 3.12.6 Windows binaries work on my system, the 3.13.0 binaries don't.

  14. ahojnnes commented on Feb 27, 2026

    @ahojnnes
    Contributor

    I just tried this on an up-to-date Ubuntu 24.04 with CUDA 13 and cannot replicate the issue. The depth maps coming out of the pipeline look good. I am using a 3080 GPU. Do you run patch match on a single or multiple GPUs?

  15. 34 remaining items

  16. ahojnnes commented on Mar 31, 2026

    @ahojnnes
    Contributor

    @tfwittwer Does really only -DCMAKE_CUDA_ARCHITECTURES=89 work or also -DCMAKE_CUDA_ARCHITECTURES=90-virtual on your end?

  17. tfwittwer commented on Mar 31, 2026

    @tfwittwer

    @ahojnnes -DCMAKE_CUDA_ARCHITECTURES=90-virtual also produces good results.

  18. ahojnnes commented on Apr 2, 2026

    @ahojnnes
    Contributor

    Thank you. I hope that #4213 now resolves your issue out of the box. Would appreciate if you can confirm (unfortunately, I don't have a suitable GPU at hand to test myself).

  19. tfwittwer commented on Apr 2, 2026

    @tfwittwer

    @ahojnnes Sure I can do that - I guess that means cloning the branch that contains #4213 and configuring without additional parameters?

  20. ahojnnes commented on Apr 2, 2026

    @ahojnnes
    Contributor

    Yes, right. Thank you!

  21. tfwittwer commented on Apr 2, 2026

    @tfwittwer

    @ahojnnes Results look good! Steps undertaken (Ubuntu 24.04, CUDA 12.8):

    git clone --single-branch --branch user/jsch/blackwell-patch-match-cuda-bug https://github.com/colmap/colmap.git
    cd colmap
    mkdir build
    cd build
    cmake ..
    

    This produced the message

    CMake Warning at src/colmap/mvs/CMakeLists.txt:193 (message):
      Blackwell GPU (sm_100+) detected.  Replacing sm_100+ architectures with
      90-virtual (PTX) for colmap_mvs_cuda to work around an NVCC compiler bug.
      Blackwell GPUs will JIT-compile from PTX at first launch (see
      https://github.com/colmap/colmap/issues/3514).
    
    

    so Blackwell detection is working.

    ninja did not work, so I did

    make
    sudo make install
    

    When running colmap gui, I got the message

    colmap: /usr/local/bin/../lib/libonnxruntime.so.1: version VERS_1.24.4' not found (required by colmap)`

    I think this is a new dependency introduced with version 4, how to deal with that is not yet explained in the manual. I disabled ONNX in CMakeLists.txt and recompiled. After that, I could run colmap. I did a new dense reconstruction. All depth and normal maps look good and so does the resulting point cloud.

  22. ahojnnes commented on Apr 2, 2026

    @ahojnnes
    Contributor

    Great, thanks, the issue with ONNX should hopefully fixed once this is fix is merged in the main branch.

  23. added a commit that references this issue on Apr 2, 2026
    9b4190b
  24. LeanderFischer commented on Apr 3, 2026

    @LeanderFischer

    Hey, I also re-built latest main (with merged #4213) on the DGX Spark. Ninja did not work either, so I also built with make, sudo make install and now I can finally produce meaningful normal/depth maps 🎉

    I did have to solve some small hiccups related to the onnxruntime, which were in my end, I think. Adding some symlinks between lib/lib64 and version 1.24.1 and 1.24.4 solved it, though.

    Thanks for digging into this issue, much appreciated 👏

  25. tfwittwer commented on Apr 3, 2026

    @tfwittwer

    I had the same onnxruntime issues, it looks like something isn't quite right there with resolving library versions.

  26. added a commit that references this issue on Apr 6, 2026
    2eb3c83
  27. LeanderFischer commented on Apr 9, 2026

    @LeanderFischer

    I had the same onnxruntime issues, it looks like something isn't quite right there with resolving library versions.

    Ah, ok, I can provide more detailed information if needed, but it wasn't hard to fix anyway, the libraries were there, just not linked/referenced correctly.

  28. LeanderFischer commented on Apr 9, 2026

    @LeanderFischer

    I do however run into an issue when running the poisson mesher now, I opened another issue for it, just in case someone is seeing the same.

  29. thexclr8er commented on Aug 12, 2026

    @thexclr8er

    #4213's PTX workaround fails when the CUDA toolkit is newer than the driver

    The sm_100+ workaround from #4213 substitutes 90-virtual (PTX) for the colmap_mvs_cuda target so Blackwell GPUs JIT from PTX at first launch. That depends on a precondition which isn't stated anywhere and doesn't always hold: the driver must be able to JIT-compile PTX emitted by the build toolkit. PTX from a toolkit newer than the driver supports is rejected outright.

    On this machine the workaround activates correctly and then dense reconstruction dies immediately:

    CUDA error at src/colmap/mvs/patch_match_cuda.cu:1682
      - the provided PTX was compiled with an unsupported toolchain.
    

    Zero depth maps and zero normal maps are written, and ~/.nv/ComputeCache stays at 0 bytes — the JIT is refused, not merely slow.

    Environment

    GPU RTX 5060 Ti 16 GB (Blackwell, sm_120)
    Driver 595.84 — nvidia-smi reports max CUDA 13.2
    Build toolkit (failing) CUDA 13.3 (nvcc 13.3.73)
    COLMAP tag 4.1.1 (a0d785f), -DCUDA_ENABLED=ON -DCMAKE_CUDA_ARCHITECTURES=120
    OS Ubuntu 26.04, gcc 15.2, glibc 2.43

    The CMake warning fires as designed, so the build is doing exactly what #4213 intends:

    CMake Warning at src/colmap/mvs/CMakeLists.txt:217 (message):
      Blackwell GPU (sm_100+) detected.  Replacing sm_100+ architectures with
      90-virtual (PTX) for colmap_mvs_cuda to work around an NVCC compiler bug.
    

    With CMAKE_CUDA_ARCHITECTURES=120 the filter keeps architectures < 100 (none) and appends 90-virtual, so colmap_mvs_cuda ends up PTX-only with no native SASS fallback. When the driver refuses that PTX there is nothing else to load, so the failure is total rather than degraded.

    Confirmed fix: build with a toolkit no newer than the driver supports

    Rebuilding only the compiler, everything else identical:

    -DCMAKE_CUDA_COMPILER=/usr/local/cuda-13.2/bin/nvcc
    

    Result on the same workspace (60 images):

    • patch_match_stereo exit 0, 120 depth + 120 normal maps
    • ~/.nv/ComputeCache grows 0 → 45 MB, i.e. the JIT actually runs
    • stereo_fusion → 405,839 points (36.7× the 11,064-point sparse model)
    • poisson_mesher → 101,609 vertices / 185,406 faces
    • zero unsupported toolchain errors

    Measured JIT cost, isolated from COLMAP's own per-view log timestamps (cold vs warm, 3 pairs): first view 29.3–29.7 s against a steady-state 4.11–4.15 s, i.e. 25.4 s ± 0.2 s one-time per compute-cache state. Worth knowing that the PTX path costs a fixed ~25 s on first launch and nothing thereafter.

    Suggested handling

    1. Configure-time check. The substitution is already conditional on detecting Blackwell; it could additionally compare CUDAToolkit_VERSION against the CUDA version nvidia-smi reports and warn (or error) when toolkit > driver. The native keyword detection already shells out to nvidia-smi, so the mechanism is present.
    2. One clause in the warning text — "requires a driver supporting CUDA ≥ the build toolkit" — would make the constraint discoverable at build time rather than at first dense run.

    Note for anyone hitting this on Ubuntu 26.04

    The apt toolkit is 13.3 and NVIDIA never published cuda-toolkit-13-2 to the ubuntu2604 repo (13-1 and 13-3 only). 13.1 is not an option either: glibc 2.43 declares rsqrt/rsqrtf noexcept and only CUDA ≥ 13.2 carries the matching _NV_GLIBC_VERSION_GE_2_42 guard, so 13.1 cannot compile the .cu files at all. That leaves a side-installed 13.2 toolkit (runfile, --toolkit only) as the single configuration satisfying both constraints.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions