From 2614b82c9a8749159314702efb61dea2b7310b59 Mon Sep 17 00:00:00 2001 From: Baptiste Rajaut Date: Mon, 19 Oct 2026 18:19:09 +0200 Subject: [PATCH] fix: list the pool's own worker cores for the start-up line and --aux-cpus under the NUMA split --- include/strata/kernels/cpu/pool.hpp | 2 ++ src/program/generate.cpp | 11 ++++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/include/strata/kernels/cpu/pool.hpp b/include/strata/kernels/cpu/pool.hpp index 9dcb349b..98320a92 100644 --- a/include/strata/kernels/cpu/pool.hpp +++ b/include/strata/kernels/cpu/pool.hpp @@ -209,6 +209,8 @@ public: bool host_works() const { return host_works_; } bool is_hybrid() const { return topo_.is_hybrid; } + /// The CPUs worker i is pinned to, in worker order (STRATA_NUMA_SPLIT reorders them: interleave_packages). + const std::vector& worker_cores() const { return topo_.worker_cores; } int p_cores() const { return topo_.p_cores; } int p_threads() const { return topo_.p_threads; } int e_cores() const { return topo_.e_cores; } diff --git a/src/program/generate.cpp b/src/program/generate.cpp index 427957b9..7366427a 100644 --- a/src/program/generate.cpp +++ b/src/program/generate.cpp @@ -5835,9 +5835,11 @@ int main(int argc, char** argv) { } { // where the threads run (--host-core) const strata::kernels::cpu::CpuTopology ht = strata::kernels::cpu::detect_cpu_topology(true, o.pool_affinity); + // the pool's own order, not a fresh detection's: STRATA_NUMA_SPLIT interleaves the sockets + const std::vector& wc = pool.worker_cores(); std::string on; - for (int i = 0; i < pool.workers() && i < (int) ht.worker_cores.size(); ++i) - on += (i > 0 ? "," : "") + std::to_string(ht.worker_cores[(size_t) i]); + for (int i = 0; i < pool.workers() && i < (int) wc.size(); ++i) + on += (i > 0 ? "," : "") + std::to_string(wc[(size_t) i]); std::fprintf(stderr, "strata generate: %d pool workers on logical processors %s, the host thread on %d%s " "(--host-core %s)\n", pool.workers(), on.c_str(), ht.host_core, pool.host_works() ? " (draining too)" : "", @@ -5846,10 +5848,9 @@ int main(int argc, char** argv) { : "first"); // --aux-cpus: the plan, now the workers' CPUs are known; the threads that exist already (the CUDA driver's) move // now when it is on, the ones created later pin themselves (strata/platform/aux_cpus.hpp) - const size_t nw = std::min((size_t) pool.workers(), ht.worker_cores.size()); + const size_t nw = std::min((size_t) pool.workers(), wc.size()); std::fprintf(stderr, "%s\n", - strata::aux_cpus::set_topology(ht.host_core, std::vector(ht.worker_cores.begin(), - ht.worker_cores.begin() + (long) nw)).c_str()); + strata::aux_cpus::set_topology(ht.host_core, std::vector(wc.begin(), wc.begin() + (long) nw)).c_str()); } if (o.no_ple_prefetch) strata::kernels::ple_prefetch_enable(false); // ---- R4's slot storage. Allocated AFTER the weights and the session, so `cudaMemGetInfo` inside `open`