Refinement: no trials run ahead on the CPU
On the CPU the trial slots share the run's threads, so a trial run ahead of the decision that needs it takes threads from the trials that are needed. Run them ahead only on the GPU, where a spare slot is a card of its own. The outcome is unchanged: trials run ahead and not needed were already discarded with their evaluations. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UqXYdJDrM65gxsCn2PrbfK
This commit is contained in:
1 parent
092634c486
commit
8ef877dc14
1 file changed
+5
-3
@@ -3275,13 +3275,15 @@ RefinementResult RefineOnce(const gemmi::Structure &placed, const std::vector<Me
|
||||
logger.Debug("Refinement: {} weight trials at a time", trial_slots.size());
|
||||
// Trials whose need is decided by others are run with them where the slots take them all at once - but not
|
||||
// where the slots share one card, whose time they would take from the trials that are needed (a model of 43k
|
||||
// atoms: the ladder 10 s ahead, 5 s not) - and left out where it is decided they were not needed, with their
|
||||
// evaluations, which do not count: the outcome and the count are the same whatever the slots.
|
||||
// atoms: the ladder 10 s ahead, 5 s not), nor on the CPU, where the slots share the threads and a trial run
|
||||
// ahead takes them from those that are needed - and left out where it is decided they were not needed, with
|
||||
// their evaluations, which do not count: the outcome and the count are the same whatever the slots.
|
||||
std::set<int> cards;
|
||||
for (const TrialSlot &s : trial_slots)
|
||||
cards.insert(s.ctx->device);
|
||||
const bool one_card = cards.size() == 1 && *cards.begin() >= 0;
|
||||
auto ahead = [&](size_t trials) { return !one_card && trial_slots.size() >= trials; };
|
||||
const bool on_gpu = ctx.engine->OnGPU();
|
||||
auto ahead = [&](size_t trials) { return on_gpu && !one_card && trial_slots.size() >= trials; };
|
||||
int ahead_evaluations = 0;
|
||||
auto drop_ahead = [&](TrialOutcome &o) {
|
||||
ahead_evaluations += o.evaluations;
|
||||
|
||||
Reference in new issue
Block a user