From d71cd5b85ef2e4247788c33c06440ae50e406f29 Mon Sep 17 00:00:00 2001 From: Filip Leonarski Date: Sun, 27 Sep 2026 07:29:27 +0200 Subject: [PATCH] RotationIndexer: the fixed-point chain's Ceres solves on 16 threads One chain runs at a time there, after the parallel candidate solves, on 1-3.5 cores of an otherwise idle machine. Ceres sums per-thread cost and gradient pieces, so the thread count may move a result at rounding level; measured, it did not: identical outputs on the four reference sweeps and all 22 smoke sets, and a sweep that indexes poorly (a chain after every spot-budget rung) went from 96 to 62 s. Co-Authored-By: Claude Opus 5.5 (1M context) Claude-Session: https://claude.ai/code/session_01D1G8gJVAy6gp1K5Dz3NE5C --- image_analysis/rotation_indexer/RotationIndexer.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/image_analysis/rotation_indexer/RotationIndexer.cpp b/image_analysis/rotation_indexer/RotationIndexer.cpp index 9b911ae3d..2a25e8ec7 100644 --- a/image_analysis/rotation_indexer/RotationIndexer.cpp +++ b/image_analysis/rotation_indexer/RotationIndexer.cpp @@ -629,9 +629,13 @@ void RotationIndexer::RunIndexingLocked() { float kept_count = -1.0f; float last_count = 0.0f; LatticeSearchResult kept_class, last_class; + // One chain runs at a time here, with the candidate solves done, so it takes the cores + // they had. Ceres sums its per-thread cost and gradient pieces, so the thread count moves + // the result at rounding level. + constexpr int kChainCeresThreads = 16; for (int r = 0; r < ROT_REFINE_OUTER_ROUNDS; ++r) { XtalOptimizerData d = best; - if (!XtalOptimizer(d, v_, kCeresThreads)) + if (!XtalOptimizer(d, v_, kChainCeresThreads)) break; const double d1 = std::abs(d.geom.GetPoniRot1_rad() - best.geom.GetPoniRot1_rad()); const double d2 = std::abs(d.geom.GetPoniRot2_rad() - best.geom.GetPoniRot2_rad());