Repository navigation
[FIX] ProSE: parallelize the calibration scoring pass (OpenMP) - #9639
timosachsenberg merged 1 commit into
Conversation
The optional mass-recalibration pass (Search:calibration:enabled) scored its spectrum subset in a fully serial loop, while the main search scores in parallel (#pragma omp parallel for). On a many-core machine the serial 10% subset took about as long as the entire parallel search, so enabling calibration roughly doubled wall-clock time for no extra useful work. Measured (172k MS2 spectra, 20 threads, same binary): - base (no calibration): 4:53 wall, CPU util ~1682% - serial calibration (before): 9:21 wall (+91%), CPU util collapses to ~965% - parallel calibration (after): 5:14 wall (+7%), CPU util ~1734% Total CPU-seconds are ~unchanged across serial vs parallel (5389 vs 5424) -- the fix adds no extra work, it only spreads the same work across cores. The CPU-utilization collapse is the signature of a serial phase in a parallel job. Parallelize runCalibrationPass_'s scoring loop the same way as the main loop (scoreSpectraAgainstIndex_): querySpectrum and the shared TheoreticalSpectrumGenerator expose const, thread-safe methods, and every working variable is loop-local. The only cross-thread write (cal_hits.push_back) is guarded by a critical section. Downstream is order-independent (cal_hits is sorted by score; the error vectors are sorted before quantiles), so the calibrated tolerances are unchanged: the window is bit-identical (serial and parallel both produce [-19.22, +19.80] on the benchmark), and ProSEAlgorithm_test calibration sections pass. Covers all three calibration call sites (non-chunked single-file, chunked single-file, chunk-major multi-file); they all funnel through runCalibrationPass_. The chunked paths additionally build a strided-sample calibration index via FragmentIndex::build, which is itself OpenMP-parallel and bounded, so it is not a serial bottleneck. Co-Authored-By: Claude Opus 4.8 <[email protected]>
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughIn ChangesProSE Calibration Parallelization
Possibly related issues
Poem
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
Problem
The optional mass-recalibration pass (
Search:calibration:enabled) scored its spectrum subset in a fully serial loop, while the main search scores in parallel (#pragma omp parallel for). On a many-core machine, the serial 10% subset takes about as long as the entire parallel search — so enabling calibration roughly doubles wall-clock time for no extra useful work.Measurements
172k MS2 spectra, 20 threads, same binary (only the calibration loop's pragmas differ):
Fix
Parallelize
runCalibrationPass_'s scoring loop the same way as the main loop (scoreSpectraAgainstIndex_):querySpectrum,reconstructModifiedSequence, and the sharedTheoreticalSpectrumGenerator::getSpectrumareconst, thread-safe methods that the main scoring loop already calls concurrently;HyperScore::computeWithDetail/Math::getPPMare static and pure.cal_hits.push_back) is guarded by acriticalsection.Correctness
Downstream is order-independent (
cal_hitsis sorted by score; the precursor/fragment error vectors are sorted before quantiles), so the calibrated tolerances do not depend on insertion order. On the benchmark, serial and parallel produce a bit-identical window[-19.22, +19.80], and theProSEAlgorithm_testcalibration sections pass unchanged.Coverage
All three calibration call sites funnel through
runCalibrationPass_, so this fixes the serial bottleneck for:The chunked paths additionally build a strided-sample calibration index via
FragmentIndex::build, which is itself OpenMP-parallel and bounded (built once, reused per file) — so it is not a serial bottleneck.🤖 Generated with Claude Code
Summary by CodeRabbit