From 3d33b888c64b51f971e59621d41cb07fcddca5c1 Mon Sep 17 00:00:00 2001 From: Filip Leonarski Date: Mon, 16 Nov 2026 03:34:11 +0100 Subject: [PATCH] FOR THE OWNER'S DECISION: on the CPU the refinement runs no population and one round RefinementSettings::lean_on_cpu (on): where the refinement runs on the CPU - no GPU wanted or none to run on - the population (2a.) and the second round (4b.) are left out, for about half of the target evaluations. Measured refine-only on 19 sets (cytC + its live set, 12 AF-start placements of the af-bench, 5 refine-arm depositions), the same protocol on the GPU where it is fast to compare (the outcome is the CPU's within the path noise): 158204 -> 76424 evaluations; R-free unchanged on 8 sets, median +0.0012, worse by 0.0012-0.0062 on 9 and by 0.0147 on the live cytC placement (an AF start the population helps), better by 0.0023 on one. Each part alone: population off -29% of the evaluations, worse on 5 of 19 (max +0.0147); one round -22%, worse on 8 (max +0.0060). Kept, measured and rejected: the twinned arm left out as well (a third of the evaluations, +0.0012 median) fails Refinement_twin_decided - a crystal 30% twinned is then refined as untwinned - so both arms still run; the ADP hypotheses off cost 0.007 in the median (max 0.044); max_steps 2 saves 7% only. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01UqXYdJDrM65gxsCn2PrbfK --- image_analysis/structure_refinement/Refinement.cpp | 11 +++++++++++ image_analysis/structure_refinement/Refinement.h | 5 +++++ 2 files changed, 16 insertions(+) diff --git a/image_analysis/structure_refinement/Refinement.cpp b/image_analysis/structure_refinement/Refinement.cpp index 3e1cf4d5c..2ade4b84b 100644 --- a/image_analysis/structure_refinement/Refinement.cpp +++ b/image_analysis/structure_refinement/Refinement.cpp @@ -4212,6 +4212,17 @@ RefinementResult RefineModel(const gemmi::Structure &placed, const std::vector &data = moved > 0 ? closed : merged; + // RefinementSettings::lean_on_cpu +#ifdef JFJOCH_USE_CUDA + const bool on_cpu = !settings.gpu || get_gpu_count() == 0; +#else + const bool on_cpu = true; +#endif + if (settings.lean_on_cpu && on_cpu) { + settings.population = 0; + settings.rounds = 1; + logger.Info("Refinement on the CPU: no population and one round (half of the evaluations)"); + } // Each arm, untwinned and twinned, is a whole refinement - the solvent built and the displacement model chosen // against its own target - and the decision is taken on where they ended. A model only scored is scored both // ways and decided by the same rule, so the R-free it reports is not an untwinned one by default. diff --git a/image_analysis/structure_refinement/Refinement.h b/image_analysis/structure_refinement/Refinement.h index 90a3c27a9..484001fd5 100644 --- a/image_analysis/structure_refinement/Refinement.h +++ b/image_analysis/structure_refinement/Refinement.h @@ -97,6 +97,11 @@ struct RefinementSettings { // model of this crystal scored on a free set drawn here). bool as_given_competes = true; bool gpu = true; + // Where the refinement runs on the CPU (no GPU wanted, or none to run on), where an evaluation costs some thirty + // times a GPU's: no population and one round, for about half of the evaluations, at an R-free 0.001 higher in the + // median of 19 sets (at most 0.015, a placed prediction the population helps). The twinned data are still refined + // against: without that arm a crystal 30% twinned is refined as untwinned. + bool lean_on_cpu = true; size_t nthreads = 1; size_t gpu_resident_bytes = 0; // held on the card by what runs beside // The most weight trials run side by side, 0 for as many as the ladders and the cards take; the result does not