From a955bee0fce81d94bd2107e70eae3b9384420a0a Mon Sep 17 00:00:00 2001 From: Filip Leonarski Date: Mon, 19 Oct 2026 11:21:25 +0200 Subject: [PATCH] PickBest: the file centre's indexing starts before the work beside it, so it overlaps the beam-centre capture wait With two or more GPUs StartCentreSpeculation joins the pre-scan's beam-centre capture; that join used to come before the file centre's schemes were indexed, so on the live server (capture 2.1 s) the file centre and the short-axis pass waited for it. The file centre's indexing now runs on its own thread while alongside() runs, and the short-axis pass is started before the centre speculation. Each indexer reads only what it was fed, so the results are unchanged. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01PXc1zD1yxHqaR1DGdCTHL4 --- rugnux/RugnuxFirstPass.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/rugnux/RugnuxFirstPass.cpp b/rugnux/RugnuxFirstPass.cpp index e6a2d7519..8228bc826 100644 --- a/rugnux/RugnuxFirstPass.cpp +++ b/rugnux/RugnuxFirstPass.cpp @@ -1099,13 +1099,15 @@ auto Rugnux::FirstPassRun::ScoreSchemes(const SchemeIndexers &ris, IndexAndRefin } // Feed the schemes, index them concurrently, and keep the best (ScoreSchemes). -// alongside: started once the schemes are fed and before they are indexed, to run beside them. +// alongside: started once the schemes are fed and their indexing has begun, to run beside it - it +// may wait (StartCentreSpeculation waits for the beam-centre capture), and the indexing goes on. auto Rugnux::FirstPassRun::PickBest(IndexerThreadPool &pool, IndexAndRefine &idx, const std::function &alongside) -> FirstPass { const SchemeIndexers ris = FeedSchemes(pool); + auto indexing = std::async(std::launch::async, [&ris] { RunIndexing(ris); }); if (alongside) alongside(); - RunIndexing(ris); + indexing.get(); return ScoreSchemes(ris, idx); } @@ -1558,9 +1560,10 @@ void Rugnux::FirstPassRun::StartShortAxisSpeculation() { } auto Rugnux::FirstPassRun::IndexSchemes() -> FirstPass { + // The short axis first: the measured centre's pass waits for the beam-centre capture. return PickBest(*indexer_pool, *indexer, [&] { - StartCentreSpeculation(); StartShortAxisSpeculation(); + StartCentreSpeculation(); }); }