Repository navigation
[PERF] S/N estimation without estimator objects: SignalToNoiseOpenMS and PeakPickerHiRes - #10611
Conversation
OpenSWATH scoring creates one SignalToNoiseOpenMS per chromatogram of a transition group, millions in a DIA run. Each constructed a SignalToNoiseEstimatorMedian, which builds its defaults, copies them, sets three values and validates the result: 7% of the samples of the scoring threads were in that parameter handling. Keep the estimators that are no longer in use in a per-thread pool (at most 64) together with the parameters they were configured with, and take one from there; it is only reconfigured if the parameters differ. init() resets everything an estimator keeps from the previous chromatogram. MRMFeatureAccessOpenMS.cpp holds two SignalToNoiseOpenMS objects with static storage duration. They are destroyed after the thread-local pool of the main thread, so the pool is reached through a flag that says whether it still exists (returning an estimator to a destroyed pool corrupted the heap at exit in eight TOPP tests of the first version). Measured with OpenDIA on an Orbitrap Astral DIA run (600k precursors, 32 threads): CPU time of extraction and scoring 37:17 min instead of 38:52 min, wall time 1:33 min instead of 1:35 min. The result table is unchanged; the new test compares pooled estimators with the values of the first ones, across chromatograms and parameter sets. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…imator Instead of a per-thread pool of SignalToNoiseEstimatorMedian objects, SignalToNoiseOpenMS computes the S/N values of its chromatogram with the new static SignalToNoiseEstimatorMedian::estimate() and keeps only them. estimate() takes the parameters as a plain Settings struct, so no parameter set is built or checked per chromatogram; it checks the ranges of the parameters itself and returns the maximal intensity and the sparse/rightmost-bin percentages. The body of computeSTN_ moved into it unchanged apart from the names, and computeSTN_ now calls it, so the estimator class behaves as before. The pool, its thread-local storage and the guard for objects destroyed after it are gone. GaussianEstimate estimate_() of SignalToNoiseEstimator is static now; it uses no member. Checked against develop's computeSTN_ (copied verbatim) on 20,000 random containers and settings in all three auto modes: all 2,937,203 S/N values, the maximal intensities and the statistics are bit-identical (GCC -O0/-O2, Clang -O2). New test sections compare SignalToNoiseOpenMS and estimate() with a configured estimator. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Sr8hFGChVGwX29y7mDXezS
… per call
pick() built a SignalToNoiseEstimatorMedian and set its parameters
(param_.copy("SignalToNoise:") + setParameters) on every call, also with
signal_to_noise 0. That is about 430 heap allocations and, on chromatograms
of 150-300 points, more time than the picking itself. PeakPickerChromatogram
calls it once per trace, so OpenSWATH and OpenDIA paid it for every fragment
trace they pick.
The S/N settings are now read once in updateMembers_() and pick() calls the
static SignalToNoiseEstimatorMedian::estimate(). For that, the Settings struct
moves out of the class template into SignalToNoiseEstimatorMedianSettings.h
(it does not depend on the container type, and PeakPickerHiRes.h can hold it
without including the estimator), with fromParam() reading a parameter set
like updateMembers_() does. SignalToNoiseEstimatorMedian<C>::Settings is an
alias of it, so existing code is unchanged.
Output is unchanged: the original and the patched PeakPickerHiRes, compiled
side by side, give bit-identical peaks, FWHM arrays and boundaries for
734,400 picks (288 parameter sets x 2,550 chromatograms and profile spectra).
pick() with the settings of PeakPickerChromatogram: 56.8 -> 12.4 us
(150 points), 71.1 -> 22.3 us (300), 119.4 -> 67.3 us (1000).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01YEL28EKUFAAs9SNwbVEV9s
The entries from #10559 for the changes of this branch. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01YEL28EKUFAAs9SNwbVEV9s
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 54 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
timosachsenberg
left a comment
There was a problem hiding this comment.
Reviewed 2934d2af for substantive issues. No actionable regressions found in the S/N refactor. I checked the settings/default mapping, estimator state updates, and PeakPickerHiRes call sites; the arithmetic and indexing are preserved for supported inputs.
Build and Test and the pyOpenMS wheel workflow passed on this head. This was a static review; I did not rerun the tests or benchmarks locally.
…#10301, #10611, #10606, #10608, #10609, #10617, #10610, #10578 ProSE Percolator rescoring, #10628) Only CHANGELOG conflicted; both entries are kept. Develop's changes to FalseDiscoveryRate, IDScoreGetterSetter, ConsensusMapMergerAlgorithm, FileInfo and ProSE work on the established classes, which this branch keeps as they are. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01B51nRFoHvZuVXD7cT8XZav
Split out of #10559 (which is closed in favour of six PRs against develop). The commits are those of #10559, cherry-picked onto develop 89cbde6; only the CHANGELOG entries were moved into a commit of their own. The measurements below were taken in #10559 on the three Orbitrap Astral DIA runs of the ProteoBench entrapment set (32 threads), where #10559 at b84b51e passed the full CI.
What
S/N estimation without estimator objects in the two places OpenSWATH/OpenDIA run it per trace. Values are unchanged.
SignalToNoiseEstimatorMedian::estimate()with the parameters as a plain settings struct, instead of constructing an estimator with its whole parameter set for every chromatogram. Against develop'scomputeSTN_, all 2,937,203 S/N values of 20,000 random containers and settings are bit-identical.pick()built aSignalToNoiseEstimatorMedianand set its parameters on every call, also withsignal_to_noise 0(about 430 heap allocations).PeakPickerChromatogramcalls it once per trace. The S/N settings are now read once inupdateMembers_()andpick()callsestimate(). For that, the settings struct moves out of the class template intoSignalToNoiseEstimatorMedianSettings.h(withfromParam());SignalToNoiseEstimatorMedian<C>::Settingsis an alias of it.Verification of the PeakPickerHiRes change
PeakPickerHiRes.cpp, compiled side by side (renamed classes, same estimator headers): bit-identical peaks, FWHM arrays and peak boundaries for 734,400 picks (288 parameter sets x 2,550 chromatograms and profile spectra).PeakPickerHiRes_test(including the S/N 1 and 4 reference outputs) andSignalToNoiseEstimatorMedian_test(with a new section forfromParam()) pass, built against the OpenMS 3.6.0 library with the changed files compiled in. Not run in a full OpenMS build; CI will.pick()with the settings of PeakPickerChromatogram, single thread: 56.8 -> 12.4 µs (150 points), 71.1 -> 22.3 µs (300), 119.4 -> 67.3 µs (1000).Not changed here
PeakPickerChromatogramnever passes itssignal_to_noiseon to itsPeakPickerHiRes: the constructor copies the default 1.0 once andupdateMembers_()does not touch it, so OpenDIA's 0.1 only affects border extension and the seeds always use 1.0. Forwarding it changes results, so it is left for a separate decision.Commits
Generated by Claude Code