Skip to content

CMAKE fails with possibly missing gencode configuration #104

Open

Description

@ShailJoshi

I am getting this error when trying to run CMAKE to build the libraries

Compiling the CUDA compiler identification source file "CMakeCUDACompilerId.cu" failed.
Compiler: /usr/bin/nvcc
Build flags:
Id flags: --keep;--keep-dir;tmp;-gencode=arch=compute_,code=sm_ -v

The output was:
1
nvcc fatal : Unsupported gpu architecture 'compute_'

I feel it is missing something really basic but not able to figure out what

Activity

  1. self-assigned this
    on Jan 2, 2026
  2. MartinPulec commented on Jan 2, 2026

    @MartinPulec
    Collaborator

    Sorry for the delayed answer.

    I think I've potentially traced the problem - it can be caused also by something else - but I've been able to replicate with CMake 3.22 and using -DCMAKE_CUDA_ARCHITECTURES=native option.

    Is this your case (cmake < 3.24) and using the native option?

    If so, just to omit -DCMAKE_CUDA_ARCHITECTURES=native. It seems like native has been added in cmake 3.24. So the hint is perhaps not usable. It is OK to remove, actually I'll consider reformulating (definitely hiding "native" for older cmake). Also using native has some disadvantages, so it may not be desirable to use.

    Show more details

    The native argument sets the CMake CUDA architecture to the value compute capability of detected NVIDIA GPU in system.

    Advantages:

    • faster first run of the application on the GPU it was build for because the byte-code is already compiled to the right version of assembler

    Disadvantages:

    • the code will perhaps not run on older NVIDIA generations (the bytecode is only forward compatible)
    • fails if no NVIDIA in build system

  3. MartinPulec commented on Jan 2, 2026

    @MartinPulec
    Collaborator

    If so, just to omit -DCMAKE_CUDA_ARCHITECTURES=native. [...]

    FYI, in addition to native (and besides the actual numeric version), all or all-major may also be used. It would, however, increase compilation time and binary size and requires the CMake >= 3.24 as well. But the written above holds - not setting anything is fine.

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions