@@ -70,7 +70,9 @@ pub fn get_affinity() -> impl Iterator<Item = Id> { from_mask(CORE_AFFINITY.get(
|
||||
/// List the cores sharing SMT-tier resources
|
||||
pub fn smt_siblings() -> impl Iterator<Item = Id> {
|
||||
from_mask(get_affinity().fold(0_u128, |mask, id| {
|
||||
mask | SMT_TOPOLOGY.get(id).expect("ID must not exceed max cpus")
|
||||
mask | SMT_TOPOLOGY
|
||||
.get(id)
|
||||
.expect("ID must not exceed max cpus")
|
||||
}))
|
||||
}
|
||||
|
||||
@@ -78,20 +80,30 @@ pub fn smt_siblings() -> impl Iterator<Item = Id> {
|
||||
/// affinity.
|
||||
pub fn node_siblings() -> impl Iterator<Item = Id> {
|
||||
from_mask(get_affinity().fold(0_u128, |mask, id| {
|
||||
mask | NODE_TOPOLOGY.get(id).expect("Id must not exceed max cpus")
|
||||
mask | NODE_TOPOLOGY
|
||||
.get(id)
|
||||
.expect("Id must not exceed max cpus")
|
||||
}))
|
||||
}
|
||||
|
||||
/// Get the cores sharing SMT resources relative to id.
|
||||
#[inline]
|
||||
pub fn smt_affinity(id: Id) -> impl Iterator<Item = Id> {
|
||||
from_mask(*SMT_TOPOLOGY.get(id).expect("ID must not exceed max cpus"))
|
||||
from_mask(
|
||||
*SMT_TOPOLOGY
|
||||
.get(id)
|
||||
.expect("ID must not exceed max cpus"),
|
||||
)
|
||||
}
|
||||
|
||||
/// Get the cores sharing Node resources relative to id.
|
||||
#[inline]
|
||||
pub fn node_affinity(id: Id) -> impl Iterator<Item = Id> {
|
||||
from_mask(*NODE_TOPOLOGY.get(id).expect("ID must not exceed max cpus"))
|
||||
from_mask(
|
||||
*NODE_TOPOLOGY
|
||||
.get(id)
|
||||
.expect("ID must not exceed max cpus"),
|
||||
)
|
||||
}
|
||||
|
||||
/// Get the number of threads which could execute in parallel based on hardware
|
||||
|
||||
@@ -42,7 +42,9 @@ pub struct Queue {
|
||||
/// Get device characteristics useful for random access throughput by name.
|
||||
#[must_use]
|
||||
pub fn parallelism(path: &Path) -> Parallelism {
|
||||
let dev_id = dev_from_path(path).log_debug_err().unwrap_or_default();
|
||||
let dev_id = dev_from_path(path)
|
||||
.log_debug_err()
|
||||
.unwrap_or_default();
|
||||
|
||||
let mq_path = block_path(dev_id).join("mq/");
|
||||
|
||||
@@ -60,7 +62,12 @@ pub fn parallelism(path: &Path) -> Parallelism {
|
||||
.into_iter()
|
||||
.flat_map(IntoIterator::into_iter)
|
||||
.filter_map(Result::ok)
|
||||
.filter(|entry| entry.file_type().as_ref().is_ok_and(FileType::is_dir))
|
||||
.filter(|entry| {
|
||||
entry
|
||||
.file_type()
|
||||
.as_ref()
|
||||
.is_ok_and(FileType::is_dir)
|
||||
})
|
||||
.map(|dir| queue_parallelism(&dir.path()))
|
||||
.collect(),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user