refactor: centralize CPU core detection using cgroup-aware utility
Release / create-release (push) Successful in 2m26s
Release / build-linux-x86_64 (push) Successful in 8m13s
Release / build-macos-arm64 (push) Successful in 1m43s
ci.yml / build (pull_request) Canceled after 1h29m17s

Introduce `obisys::effective_parallelism()` to read Linux cgroup v1/v2 CPU quotas from sysfs, preventing thread pool oversubscription in containerized environments. Replace direct `std::thread::available_parallelism()` calls across `obikindex` and `obikmer` with this centralized function. Bump `obikmer` version to 1.1.41.
This commit is contained in:
Eric Coissac
2026-08-11 12:23:05 +02:00
parent 2e7cfc4368
commit 5f95e866f8
8 changed files with 97 additions and 19 deletions
+2 -6
View File
@@ -79,9 +79,7 @@ pub fn build() -> NumaSetup {
}
// UMA fallback: single synthetic node, all cores, no pool, no pinning.
let n_cores = std::thread::available_parallelism()
.map(|n| n.get())
.unwrap_or(1);
let n_cores = obisys::effective_parallelism();
debug!("UMA: single synthetic node, {} core(s)", n_cores);
NumaSetup {
pools: vec![None],
@@ -91,9 +89,7 @@ pub fn build() -> NumaSetup {
#[cfg(not(feature = "numa"))]
pub fn build() -> NumaSetup {
let n_cores = std::thread::available_parallelism()
.map(|n| n.get())
.unwrap_or(1);
let n_cores = obisys::effective_parallelism();
debug!("UMA: single synthetic node, {} core(s)", n_cores);
NumaSetup {
pools: vec![None],
+1 -1
View File
@@ -350,7 +350,7 @@ impl KmerIndex {
// every single variant — fine at the scale of a handful of test
// k-mers, but with billions of lookups against a real index this
// manifested as ~90% system time, observed in practice. ───────────
let n_workers = std::thread::available_parallelism().map(|n| n.get()).unwrap_or(4);
let n_workers = obisys::effective_parallelism();
let capacity = 256;
// Throttling is not optional once a `Flat` stage is in the pipeline