Skip to content

fix: replace hardcoded kNumThreads with ROOT::EnableImplicitMT()#95

Merged
wdconinc merged 1 commit intomasterfrom
remove-mt-header
Apr 28, 2026
Merged

fix: replace hardcoded kNumThreads with ROOT::EnableImplicitMT()#95
wdconinc merged 1 commit intomasterfrom
remove-mt-header

Conversation

@wdconinc
Copy link
Copy Markdown
Contributor

@wdconinc wdconinc commented Apr 27, 2026

Summary

common_bench/mt.h defines a single compile-time constant kNumThreads = 8, which was used in three analysis scripts to limit ROOT's implicit multithreading. This value:

  • Ignores $BENCHMARK_N_THREADS from env.sh (CI default: 10)
  • Disagrees with the majority of scripts — every other analysis in both detector_benchmarks and physics_benchmarks already calls ROOT::EnableImplicitMT() with no argument
  • Was flagged with a TODO in the header itself that was never resolved

ROOT::EnableImplicitMT() with no argument tells ROOT to use all available hardware threads, which is the correct behavior for CI runners where you want maximum utilization.

Changes

In three files, replace ROOT::EnableImplicitMT(kNumThreads)ROOT::EnableImplicitMT() and remove #include "common_bench/mt.h":

  • benchmarks/Exclusive-Diffraction-Tagging/dvmp/analysis/vm_mass.cxx
  • benchmarks/Exclusive-Diffraction-Tagging/dvmp/analysis/vm_invar.cxx
  • benchmarks/Inclusive/dis/analysis/dis_electrons.cxx

Related

This removes the last users of common_bench/mt.h, allowing it to be deleted: eic/common_bench#4

common_bench/mt.h defines kNumThreads=8 as a compile-time constant,
which ignores $BENCHMARK_N_THREADS from env.sh (default: 10). This
is inconsistent with every other analysis script in both benchmark
repos, which already use ROOT::EnableImplicitMT() with no argument.

Replace ROOT::EnableImplicitMT(kNumThreads) with the no-arg form in:
- dvmp/analysis/vm_mass.cxx
- dvmp/analysis/vm_invar.cxx
- Inclusive/dis/analysis/dis_electrons.cxx

ROOT's no-arg EnableImplicitMT() auto-selects the optimal thread count
for the available hardware, which is strictly better for CI runners.
This also removes the last users of common_bench/mt.h, allowing that
header to be deleted from common_bench.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 27, 2026 20:33
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR standardizes ROOT implicit multithreading configuration in a few benchmark analyses by removing use of a hardcoded thread-count constant and letting ROOT choose the default thread pool size.

Changes:

  • Replace ROOT::EnableImplicitMT(kNumThreads) with ROOT::EnableImplicitMT().
  • Remove the now-unneeded #include "common_bench/mt.h" from the affected analyses.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
benchmarks/Inclusive/dis/analysis/dis_electrons.cxx Switch to default ROOT implicit MT and drop common_bench/mt.h include.
benchmarks/Exclusive-Diffraction-Tagging/dvmp/analysis/vm_mass.cxx Switch to default ROOT implicit MT and drop common_bench/mt.h include.
benchmarks/Exclusive-Diffraction-Tagging/dvmp/analysis/vm_invar.cxx Switch to default ROOT implicit MT and drop common_bench/mt.h include.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread benchmarks/Inclusive/dis/analysis/dis_electrons.cxx
@veprbl veprbl enabled auto-merge (squash) April 27, 2026 20:40
@wdconinc wdconinc disabled auto-merge April 28, 2026 01:21
@wdconinc wdconinc merged commit 421f0d1 into master Apr 28, 2026
6 checks passed
@wdconinc wdconinc deleted the remove-mt-header branch April 28, 2026 01:23
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.

3 participants