From 18835f93f802088e962e3e21cc0801becbcbbc27 Mon Sep 17 00:00:00 2001 From: Filip Leonarski Date: Thu, 15 Oct 2026 22:53:48 +0200 Subject: [PATCH] Rotation scaling: merge working arrays also handed back after the serial all-observation merge and before the analyses, output unchanged The two other points between merges where the engine's MergeAndStats arrays (~330 B per ASU group and ~55 B per full; ~3 GiB per P1 merge on a 400 A cell) sat beside other work: - the all-observation arm merged in series (the CPU path, or a card too small for the arm beside), whose arrays were held through that arm's SearchSpaceGroup; - after the answer's merge, through the analyses (a twin-law or ledger merge refills them). -N 10 --no-gpu (the macOS path's thread count): myob_x10sa 7.73 -> 7.28, cytc_x10sa 7.96 -> 7.56, 4nwv (timing benchmark) 20.34 -> 20.07 GiB peak RSS. Outputs byte-identical (p.hkl, MTZ column data, maps, placed model, report fields) at -N 10 on the CPU path and on the GPU path for myob_x10sa, cytc_x10sa, 4nwv, 8qaw. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01PXc1zD1yxHqaR1DGdCTHL4 --- rugnux/RugnuxScaleMerge.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/rugnux/RugnuxScaleMerge.cpp b/rugnux/RugnuxScaleMerge.cpp index 1814d489b..658fadb27 100644 --- a/rugnux/RugnuxScaleMerge.cpp +++ b/rugnux/RugnuxScaleMerge.cpp @@ -1699,6 +1699,7 @@ bool Rugnux::ScaleMergeAndSymmetry(PipelineLocals &p) { rsm->SetSearchMinZeta(0.0); sm_all = scale_and_merge("P1, all observations", true); rsm->SetSearchMinZeta(zeta); + rsm->ReleaseMergeScratch(); // as before the first arm's search sg_opts.merge_isa = result.error_model_isa; // this arm's own error model TimingMark all_arm_mark(logger, "SearchSpaceGroup (all-observation arm)"); alt = SearchSpaceGroup(sm_all.merged, sg_opts); @@ -3309,6 +3310,9 @@ bool Rugnux::ScaleMergeAndSymmetry(PipelineLocals &p) { } adoption_mark.Stop(); TimingMark analyses_mark(logger, "analyses"); + // The answer's merge is made and in `sm`; a merge below (twin law, ledger) refills the arrays. + if (rsm) + rsm->ReleaseMergeScratch(); // --finalist-ledger (see where it is read, below) is folded from a merge of its own: the same // observations in P1. It needs every node of the lattice integrated, which a fixed centred group