rugnux: the measured-centre spot finding beside the first pass keeps off the first pass's card
With two cards or more, the speculation's spot-finding workers took card t % cards, so some of them shared card 0 with the first pass they run beside. They now take the other cards, worker t on card 1 + t % (cards - 1): on two cards all of them on card 1, as before the previous commit, and on more cards spread over cards 1..n-1. Spots are a pure function of the frame, so the card cannot change them; on one card the speculation does not start. Not measured on more than one card. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SVmAWnzCmRKAXVUCdc4iNi
This commit is contained in:
1 parent
f33d8e2a68
commit
291240a969
1 file changed
+9
-7
@@ -119,10 +119,10 @@ namespace {
|
||||
return spots;
|
||||
}
|
||||
|
||||
// First-pass spot finding on workers of its own, spread over the cards as the first pass's own
|
||||
// workers are (worker t on card t % cards), for work that runs beside the first pass. Each worker
|
||||
// keeps its engine from one call to the next - building one costs far more than a frame - and
|
||||
// gives it back on that card.
|
||||
// First-pass spot finding on workers of its own, for work that runs beside the first pass: spread
|
||||
// over the cards other than card 0, which the first pass itself keeps busy (worker t on card
|
||||
// 1 + t % (cards - 1); card 0 only on a one-card machine). Each worker keeps its engine from one
|
||||
// call to the next - building one costs far more than a frame - and gives it back on that card.
|
||||
class SpotFindingWorkers {
|
||||
public:
|
||||
SpotFindingWorkers(JFJochReader &reader, const DiffractionExperiment &x,
|
||||
@@ -165,13 +165,15 @@ namespace {
|
||||
std::unique_ptr<AzimuthalIntegrationProfile> profile;
|
||||
};
|
||||
|
||||
// fn(t) on n threads of its own, thread t on card t % cards: the card its engine lives on.
|
||||
// fn(t) on n threads of its own, thread t on the card its engine lives on.
|
||||
template <class Fn> void OnWorkers(size_t n, Fn fn) {
|
||||
std::vector<std::future<void>> futures;
|
||||
for (size_t t = 0; t < n; t++)
|
||||
futures.emplace_back(std::async(std::launch::async, [this, &fn, t] {
|
||||
if (const int32_t gpus = get_gpu_count(); gpus > 0)
|
||||
pin_gpu(static_cast<int32_t>(t) % gpus);
|
||||
if (const int32_t gpus = get_gpu_count(); gpus > 1)
|
||||
pin_gpu(1 + static_cast<int32_t>(t) % (gpus - 1));
|
||||
else if (gpus == 1)
|
||||
pin_gpu(0);
|
||||
fn(t);
|
||||
}));
|
||||
for (auto &f : futures)
|
||||
|
||||
Reference in new issue
Block a user