Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions crates/aprender-distribute/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ documentation = "https://docs.rs/repartir"

[features]
default = ["cpu"]
cpu = ["tokio", "num_cpus"]
cpu = ["tokio"]
gpu = ["wgpu", "pollster"]
remote = ["tokio", "bincode", "tracing-subscriber"]
remote-tls = ["remote", "rustls", "tokio-rustls", "rustls-pemfile"]
Expand All @@ -34,7 +34,6 @@ name = "repartir"
tokio = { version = "1.35", features = ["rt-multi-thread", "sync", "time", "process", "io-util", "macros", "net"], optional = true }

# CPU backend
num_cpus = { version = "1.16", optional = true }

# GPU backend (pure Rust via gfx-rs)
# wgpu provides cross-platform GPU compute (Vulkan/Metal/DX12/WebGPU)
Expand Down
9 changes: 8 additions & 1 deletion crates/aprender-distribute/src/executor/cpu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,16 @@ impl CpuExecutor {
/// Creates a new CPU executor.
///
/// Detects the number of available CPU cores automatically.
///
/// Uses `std::thread::available_parallelism`, stable since Rust 1.59 and far
/// below this workspace's 1.91 MSRV, rather than the `num_cpus` crate. That
/// dependency was optional and pulled by ONE feature (`cpu`) while this file
/// compiles under any feature enabling `tokio`, so six sibling selections
/// could not link it. Falling back to 1 when the count is undeterminable
/// matches what `num_cpus::get()` returned in the same situation.
#[must_use]
pub fn new() -> Self {
let num_cpus = num_cpus::get();
let num_cpus = std::thread::available_parallelism().map_or(1, std::num::NonZeroUsize::get);
info!("CpuExecutor initialized with {num_cpus} cores");
Self { num_cpus }
}
Expand Down
Loading