Skip to content

[RF] Plot the cost per likelihood eval and event in benchRooFitBackends - #316

Merged
guitargeek merged 3 commits into
root-project:masterfrom
guitargeek:roofit-cuda
Oct 19, 2026
Merged

guitargeek merged 3 commits into
root-project:masterfrom
guitargeek:roofit-cuda

Conversation

@guitargeek

Copy link
Copy Markdown
Contributor

The speedup relative to the single-threaded CPU backend depends on the CPU in ways that the plot can't show: on a Zen 2 CPU, the Gaussian resolution models are much slower on the CPU than on Zen 3 because of a slow libm erfc, which inflates their CUDA speedup. The plot therefore now shows absolute numbers:

  • The quantity is the fit time divided by the number of likelihood evaluations and the number of events, in ns. This removes the large differences in fit time between the models and between runs with different numbers of events.
  • A dot plot on a fixed logarithmic axis, one row per model and one marker per backend, with a line spanning the backends. The speedups are the distances between the markers.
  • Fits that did not converge are marked.
  • --compare overlays a second run with hollow markers, e.g. from another machine, and the run information table shows both runs.

The speedup relative to the single-threaded CPU backend depends on the
CPU in ways that the plot can't show: on a Zen 2 CPU, the Gaussian
resolution models are much slower on the CPU than on Zen 3 because of a
slow libm erfc, which inflates their CUDA speedup. The plot therefore now
shows absolute numbers:

  * The quantity is the fit time divided by the number of likelihood
    evaluations and the number of events, in ns. This removes the large
    differences in fit time between the models and between runs with
    different numbers of events.
  * A dot plot on a fixed logarithmic axis, one row per model and one
    marker per backend, with a line spanning the backends. The speedups
    are the distances between the markers.
  * Fits that did not converge are marked.
  * --compare overlays a second run with hollow markers, e.g. from another
    machine, and the run information table shows both runs.
The Gamma component of FitModel (mean 9, width 2.2) was nearly identical
to the broad Gaussian (mean 10, width 2), so their yields were almost
degenerate, and the yield ranges up to 1e9 and 1e10 put the start values
of the fit 1e7 to 1e8 events away from the truth. Migrad often failed to
converge: at 1M events with the fixed seed on all backends, and for most
random seeds.

The Gamma component is now a shoulder at low x (mean 3), and the yield
ranges go up to ten times the number of events. With this, the fit
converges for all tested seeds at 100k and 1M events, the fitted yields
are within a few percent of the truth, and all backends do the same
number of likelihood evaluations.
Without an offset, Migrad fails to reach the required EDM for the FitModel
benchmark from a few million events on (status -1 at 3M and 10M events, on
all backends), because the rounding errors of the large absolute NLL values
spoil the numerical gradients. Offsetting the likelihood by its initial
value is what should be done for large datasets anyway, and it doesn't
change the cost per likelihood evaluation.
@guitargeek
guitargeek merged commit 26dda4a into root-project:master Oct 19, 2026
1 check passed
@guitargeek
guitargeek deleted the roofit-cuda branch October 19, 2026 09:45
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.

1 participant