hwlocality 1.0.0-alpha.12

Idiomatic Rust bindings for the hwloc hardware locality library
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use hwlocality::{Topology, object::depth::NormalDepth};

/// Walk the topology with an array style, from depth 0 (always Machine)
/// to the lowest depth (always logical processors).
fn main() -> eyre::Result<()> {
    let topology = Topology::new()?;

    for depth in NormalDepth::iter_range(NormalDepth::MIN, topology.depth()) {
        println!("*** Objects at depth {depth}");

        for (idx, object) in topology.objects_at_depth(depth).enumerate() {
            println!("{idx}: {object}");
        }
    }

    Ok(())
}