rugnux live: plan against the memory the machine has beside the broker
RugnuxHostBudget took the image buffer and the 16 GiB margin off the machine's budget (75% of its memory). The 25% the budget leaves out is already the reserve for the rest of the machine, and the margin keeps the broker's own part, so the reserve was counted twice: with an 80 GiB image buffer on a 134.5 GB machine, 0.75 x 134.5 GB - (85.9 + 17.2) GB < 0 and rugnux planned against 1 byte. The post-refinement then ran before the merge instead of beside it, the all-observation P1 merge after this engine's instead of beside it, and HostWorkerPool held one worker (molecular replacement and the null replicates single-worker live). Now the buffer and the margin come off the machine's total, capped at the machine's budget: min(0.75 x total, total - buffer - margin), 1 byte only where nothing is left. Here that is 31.5 GB. Chosen over MemAvailable because the plan is decided from totals everywhere else (HostMemory.h), so the schedule does not depend on what happens to be cached at the start of a collection; and over a fixed floor because the floor would plan memory a misconfigured buffer has already taken. Scheduling only: what runs side by side, never what is computed. Live replay, thau 1000 EIGER 16M frames at 100 Hz: the run now plans against 31.5 GB; the post-refinement is no longer done before the merge, and "wait for the all-observation merge" is 0.264-0.271 s -> 0.000 s. With the ISa bootstrap change after this one, "Scaling and merging" is 1.88-1.94 s -> 1.56-1.62 s. Merged MTZ, maps, models, blobs and every non-timing field of /rugnux/status identical to the base binary's. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HVeDQsU5a8AJUdJPgWevAK
This commit is contained in:
1 parent
21845e91f5
commit
22d638b030
1 file changed
+9
-5
@@ -3,6 +3,7 @@
|
||||
|
||||
#include "JFJochReceiverRugnux.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
|
||||
#include "spdlog/fmt/fmt.h"
|
||||
@@ -24,14 +25,17 @@ namespace {
|
||||
// rugnux plans against is decided.
|
||||
constexpr size_t RUGNUX_HOST_MEMORY_MARGIN = 16ULL * 1024 * 1024 * 1024;
|
||||
|
||||
// The host memory rugnux plans against (HostMemory.h) is the machine's budget less what the broker
|
||||
// The host memory rugnux plans against (HostMemory.h) is what the machine has beside what the broker
|
||||
// already holds: the image buffer, which has to keep the whole collection and so is most of the
|
||||
// machine, and a margin. Never 0, which would take the whole machine's budget: at worst what could
|
||||
// run side by side runs one part after the other.
|
||||
// machine, and a margin - at most the machine's budget. Both come off the machine's total, not off the
|
||||
// budget: the budget's own fraction is the reserve for the rest of the machine, which the margin already
|
||||
// keeps for the broker, and taken off twice it left nothing (1 byte) with a buffer sized to most of the
|
||||
// machine. Never 0, which would take the whole machine's budget: at worst what could run side by side
|
||||
// runs one part after the other.
|
||||
size_t RugnuxHostBudget(const ImageBuffer &buffer) {
|
||||
const size_t budget = DefaultHostMemoryBudget();
|
||||
const size_t total = get_host_total_memory();
|
||||
const size_t taken = buffer.GetBufferSize() + RUGNUX_HOST_MEMORY_MARGIN;
|
||||
return budget > taken ? budget - taken : 1;
|
||||
return total > taken ? std::min(DefaultHostMemoryBudget(), total - taken) : 1;
|
||||
}
|
||||
|
||||
double SecondsSince(std::chrono::steady_clock::time_point t) {
|
||||
|
||||
Reference in new issue
Block a user