Build Packages / Create release (push) Successful in 26s
Build Packages / Build documentation (push) Successful in 1m43s
Build Packages / build:portable:macos-arm64:nocuda (push) Successful in 5m7s
Build Packages / build:portable:linux-x86_64:nocuda (push) Successful in 11m48s
Build Packages / build:rugnux:linux-aarch64:cuda (push) Successful in 7m22s
Build Packages / build:portable:linux-x86_64:cuda (push) Successful in 12m24s
Build Packages / HDF5 consumer tests (DIALS, XDS) (push) Successful in 25m30s
Build Packages / build:portable:windows-x86_64:nocuda (push) Successful in 25m29s
Build Packages / build:portable:windows-x86_64:cuda (push) Successful in 29m41s
Build Packages / build:jfjoch:ubuntu2204:nocuda (push) Successful in 21m44s
Build Packages / build:jfjoch:rocky8:nocuda (push) Successful in 24m41s
Build Packages / build:jfjoch:rocky9:nocuda (push) Successful in 26m9s
Build Packages / build:jfjoch:ubuntu2404:nocuda (push) Successful in 26m3s
Build Packages / build:jfjoch:rocky8:cuda-sls9 (push) Successful in 28m28s
Build Packages / Generate python client (push) Successful in 27s
Build Packages / build:jfjoch:rocky9:cuda-sls9 (push) Successful in 31m16s
Build Packages / build:jfjoch:ubuntu2204:cuda (push) Successful in 20m44s
Build Packages / build:jfjoch:rocky8:cuda (push) Successful in 26m27s
Build Packages / build:jfjoch:ubuntu2404:cuda (push) Successful in 22m52s
Build Packages / build:jfjoch:rocky9:cuda (push) Successful in 27m44s
Build Packages / Unit tests (push) Successful in 1h46m55s
Build Packages / Validation Battery (push) Successful in 52m50s
* Rugnux: Several rotation sweeps of one crystal are merged as one dataset (`rugnux a_master.h5 b_master.h5`), on a common indexing and cell, with a non-isomorphous sweep left out and reported; `--sweeps separate` processes each sweep on its own. Bruker `.sfrm` frames and imgCIF files with a full goniometer axis chain are read. * Rugnux: More robust rotation processing - a retry with a more sensitive spot finder when no lattice is found, a self-consistent detector distance, long axes and doubled cells tested as hypotheses, a `-C` supercell multiple stepped down, and each ice ring merged, down-weighted or rejected on its own. * Rugnux: Serial stills are merged with a partiality-aware error model, reported as `ERROR_MODEL_A/B/C` with no ISa or R_merge/R_meas/R_pim; runs without `-S` have an overall intensity scale about 0.86-0.88 times that of earlier versions, with unchanged statistics. A second crystal form is left out of the merge and reported, the indexing ambiguity is resolved more reliably, and `--model` no longer influences processing. * Rugnux: The reported CC1/2 is the standard unweighted one, which can be lower than before on sweeps with weak frames; ISa comes with a 95% interval (`ISA_LOW`/`ISA_HIGH`). * Rugnux: Model refinement adds anisotropic/TLS, local NCS and twin refinement where R-free supports them; building waters and relabelling ions is now off by default (`--refine-solvent` turns it on). * NXmx: A detector of several modules is written as `module_0` ... `module_N` only, so DIALS reads each module as its own panel. * Other: JPEG previews use a bundled encoder (libjpeg-turbo no longer needed), Rugnux prints how to cite it, and the release archives contain the HTML documentation. Reviewed-on: #92 Co-authored-by: Filip Leonarski <filip.leonarski@psi.ch>
91 lines
3.5 KiB
C++
91 lines
3.5 KiB
C++
// SPDX-FileCopyrightText: 2026 Filip Leonarski, Paul Scherrer Institute <filip.leonarski@psi.ch>
|
|
// SPDX-License-Identifier: GPL-3.0-only
|
|
|
|
#include <catch2/catch_all.hpp>
|
|
|
|
#include <algorithm>
|
|
#include <atomic>
|
|
#include <chrono>
|
|
#include <thread>
|
|
#include <tuple>
|
|
#include <vector>
|
|
|
|
#include "../common/HostMemory.h"
|
|
|
|
TEST_CASE("HostMemory_BudgetFromTheTotal", "[HostMemory]") {
|
|
const size_t total = get_host_total_memory();
|
|
REQUIRE(total > 0);
|
|
CHECK(DefaultHostMemoryBudget() == static_cast<size_t>(HOST_MEMORY_BUDGET_FRACTION * static_cast<double>(total)));
|
|
}
|
|
|
|
// As many reservations at once as the pool holds, and one at a time where a single one is larger than it.
|
|
TEST_CASE("HostWorkerPool_BoundsWorkersByBytes", "[HostMemory]") {
|
|
HostWorkerPool &pool = HostWorkerPool::Instance();
|
|
for (const auto &[size, bytes, at_most] : std::vector<std::tuple<size_t, size_t, int>>{
|
|
{100, 40, 2}, {100, 100, 1}, {100, 1000, 1}, {1000, 10, 8}}) {
|
|
CAPTURE(size, bytes);
|
|
pool.SetSize(size);
|
|
std::atomic<int> running{0}, most{0}, done{0};
|
|
std::vector<std::thread> workers;
|
|
for (int i = 0; i < 8; i++)
|
|
workers.emplace_back([&] {
|
|
const HostWorkerPool::Reservation reserved(pool, bytes);
|
|
const int now = ++running;
|
|
int seen = most.load();
|
|
while (now > seen && !most.compare_exchange_weak(seen, now)) {}
|
|
std::this_thread::sleep_for(std::chrono::milliseconds(20));
|
|
--running;
|
|
++done;
|
|
});
|
|
for (auto &w : workers)
|
|
w.join();
|
|
CHECK(done == 8);
|
|
CHECK(most >= 1);
|
|
CHECK(most <= at_most);
|
|
}
|
|
pool.SetSize(0);
|
|
CHECK(pool.Size() == static_cast<size_t>(HOST_WORKER_POOL_FRACTION * static_cast<double>(DefaultHostMemoryBudget())));
|
|
}
|
|
|
|
// One ledger: what the run holds (Held) and what the workers reserve together stay within the budget. Workers
|
|
// take what the Held bytes leave of it, up to the pool's size, and a worker larger than that runs alone rather
|
|
// than never.
|
|
TEST_CASE("HostWorkerPool_HeldBytesShareTheBudget", "[HostMemory]") {
|
|
HostWorkerPool &pool = HostWorkerPool::Instance();
|
|
pool.SetBudget(100);
|
|
pool.SetSize(50);
|
|
CHECK(pool.Size() == 50);
|
|
const auto most_at_once = [&](size_t bytes) {
|
|
std::atomic<int> running{0}, most{0}, done{0};
|
|
std::vector<std::thread> workers;
|
|
for (int i = 0; i < 8; i++)
|
|
workers.emplace_back([&] {
|
|
const HostWorkerPool::Reservation reserved(pool, bytes);
|
|
const int now = ++running;
|
|
int seen = most.load();
|
|
while (now > seen && !most.compare_exchange_weak(seen, now)) {}
|
|
std::this_thread::sleep_for(std::chrono::milliseconds(20));
|
|
--running;
|
|
++done;
|
|
});
|
|
for (auto &w : workers)
|
|
w.join();
|
|
CHECK(done == 8);
|
|
return most.load();
|
|
};
|
|
{
|
|
HostWorkerPool::Held run(pool, 70); // leaves 30 of the budget: the pool's 50 does not fit beside it
|
|
CHECK(pool.Size() == 30);
|
|
CHECK(most_at_once(10) <= 3);
|
|
run.Set(20); // leaves 80: the pool's own size bounds again
|
|
CHECK(pool.Size() == 50);
|
|
CHECK(most_at_once(10) <= 5);
|
|
run.Set(100); // nothing left: one at a time, each still runs
|
|
CHECK(pool.Size() == 0);
|
|
CHECK(most_at_once(10) == 1);
|
|
}
|
|
CHECK(pool.Size() == 50);
|
|
pool.SetBudget(0);
|
|
pool.SetSize(0);
|
|
}
|