Skip to content

[cmake] Require explicit CUDA feature selection - #23903

Merged
guitargeek merged 2 commits into
root-project:masterfrom
jmcarcell:cmake-skip-unrequested-cuda-detection
Nov 2, 2026
Merged

guitargeek merged 2 commits into
root-project:masterfrom
jmcarcell:cmake-skip-unrequested-cuda-detection

Conversation

@jmcarcell

@jmcarcell jmcarcell commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

This Pull request:

Require explicit enablement of CUDA features, including in builds configured with all=ON.

Changes or fixes:

ROOT currently probes for a CUDA compiler on every configure and, with all=ON, automatically enables cuda and tmva-gpu when a compiler is found. Compiler discovery starts a separate CMake configuration and accesses compiler and toolkit files, adding avoidable configuration time in slow I/O environments and on NFS-backed filesystems.

Only probe for and initialize CUDA when cuda or tmva-gpu is enabled. Both options remain OFF by default under all, even when CUDA compiler information is already cached. For example, all=ON cuda=ON enables cuda without automatically enabling tmva-gpu.

Explicit settings, including existing cached ON values, continue to take precedence over defaults. CUDA discovery and initialization for explicitly enabled features retain their existing behavior.

Checklist:

  • tested changes locally
  • updated the docs (if necessary)

No documentation changes are needed. No associated issue.

@jmcarcell
jmcarcell requested a review from bellenot as a code owner October 30, 2026 07:33
CUDA compiler discovery starts a separate CMake configuration even when
neither CUDA feature is requested. This can add substantial overhead on
slow I/O and NFS-backed filesystems.

Only discover CUDA for explicit requests or when all needs availability
information to select defaults. Preserve explicit OFF settings and
gminimal defaults, and cover these combinations with regression tests.

Assisted-by: Codex:GPT-6
@dpiparo

dpiparo commented Oct 30, 2026

Copy link
Copy Markdown
Member

@guitargeek btw, with the plan of externalising SOFIE, do we still need the tmva-gpu option?

@guitargeek

Copy link
Copy Markdown
Contributor

The tmva-cpu and tmva-gpu options are for the TMVA deep learning methods that were written ~10 years ago to compete with the Python ML libraries, before the strategy was changed to not compete but embrace. This functionality is unrelated to SOFIE, and currently not deprecated. However, I think it would be good to have a conversation on the future of that functionality soon, in this development cycle!

@github-actions

github-actions Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Test Results

    21 files      21 suites   3d 10h 23m 19s ⏱️
 3 883 tests  3 535 ✅   0 💤 348 ❌
72 190 runs  70 660 ✅ 837 💤 693 ❌

For more details on these failures, see this check.

Results for commit 33f50fc.

♻️ This comment has been updated with latest results.

@dpiparo

dpiparo commented Oct 31, 2026

Copy link
Copy Markdown
Member

Thanks. Agreed then!

@guitargeek guitargeek left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you very much for bringing this up! I'd just suggest to go one step further, simplifying the logic by not considering cuda and tmva-gpu as "major options". The all build flag doesn't enable all options, and it's mostly up to our judgment what we consider as "major".

What do you think? Would that suggestion also work for you?

Also, would it be fine to remove the unit test again? AI agents like to test everything, but I would prefer to not start entering the rabbit hole of testing CMake configuration paths from now on...

Comment thread cmake/modules/CheckCompiler.cmake Resolved
Keep CUDA features opt-in even with all enabled, including when CUDA
compiler information is already cached. Simplify compiler discovery
and remove the configuration test suite as requested in review.

Validate option combinations using a temporary external harness.

Assisted-by: Codex:GPT-6

@guitargeek guitargeek left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thank you very much

@guitargeek

Copy link
Copy Markdown
Contributor

@jmcarcell I assume you need a backport to 6.42. Also older ROT releases?

@jmcarcell

Copy link
Copy Markdown
Contributor Author

It's ok if it's only in master.
Note that this changes existing behavior, all=ON doesn't enable cuda nor tmva-gpu and all=ON cuda=ON doesn't enable tmva-gpu (previously both of these were true).

@jmcarcell jmcarcell changed the title [cmake] Skip unrequested CUDA compiler detection [cmake] Require explicit CUDA feature selection Nov 2, 2026
@guitargeek

Copy link
Copy Markdown
Contributor

Yes, that's why I prefer to not backport it to the existing patch release branches. 6.42 is so far unreleased (there is only a release candidate), so I think that is okay

@guitargeek
guitargeek merged commit 045fca8 into root-project:master Nov 2, 2026
30 of 34 checks passed
@guitargeek

Copy link
Copy Markdown
Contributor

/backport to 6.42

@root-project-bot

Copy link
Copy Markdown

Preparing to backport PR #23903 to branch 6.40 requested by guitargeek

@root-project-bot

Copy link
Copy Markdown

Preparing to backport PR #23903 to branch 6.42 requested by guitargeek

@root-project-bot

Copy link
Copy Markdown

This PR has been backported to branch 6.40: #23946

@root-project-bot

Copy link
Copy Markdown

This PR has been backported to branch 6.42: #23947

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants