From ec02b181dbda2d147b57ce6ef90687e9d44fb0eb Mon Sep 17 00:00:00 2001 From: Filip Leonarski Date: Wed, 14 Oct 2026 19:42:31 +0200 Subject: [PATCH] rugnux: relabel the integrated reflections in parallel, output unchanged reseat_integrated changed the basis of every integrated reflection on the main thread. One image per task now; each touches only its own outcome. Measured on 4nwv (CPU-only): 2.1 s of serial time. Co-Authored-By: Claude Opus 5.5 --- rugnux/RugnuxScaleMerge.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/rugnux/RugnuxScaleMerge.cpp b/rugnux/RugnuxScaleMerge.cpp index 45a20da2b..a36205b67 100644 --- a/rugnux/RugnuxScaleMerge.cpp +++ b/rugnux/RugnuxScaleMerge.cpp @@ -602,13 +602,16 @@ bool Rugnux::ScaleMergeAndSymmetry(PipelineLocals &p) { const auto reseat_integrated = [&](const gemmi::Op &cob) { const gemmi::Mat33 basis = BasisMatrix(cob); const gemmi::Op hkl = HklOperator(cob); - for (auto &io : indexer->GetIntegrationOutcome()) { + // One image per task: each touches only its own outcome. + auto &outcomes = indexer->GetIntegrationOutcome(); + ParallelFor(static_cast(outcomes.size()), config_.nthreads, [&](int o) { + auto &io = outcomes[o]; io.latt = io.latt.Multiply(basis); for (auto &r : io.reflections) { const gemmi::Op::Miller h = hkl.apply_to_hkl({{r.h, r.k, r.l}}); r.h = h[0]; r.k = h[1]; r.l = h[2]; } - } + }); result.consensus_cell = CellInBasis(*result.consensus_cell, cob); end_msg.unit_cell = result.consensus_cell; if (end_msg.rotation_lattice.has_value())