pub struct NumaTopology {
pub nodes: Vec<NumaNode>,
pub gpu_node_map: HashMap<u32, u32>,
}Expand description
NUMA topology information for a system.
Fields§
§nodes: Vec<NumaNode>§gpu_node_map: HashMap<u32, u32>GPU-to-NUMA-node mapping (gpu_id -> node_id).
Implementations§
Source§impl NumaTopology
impl NumaTopology
Sourcepub fn detect() -> Self
pub fn detect() -> Self
Detect NUMA topology from the system. On non-Linux or single-node systems, returns a single flat node.
fn detect_linux() -> Result<Self>
Sourcepub fn gpu_numa_node(&self, gpu_id: u32) -> Option<u32>
pub fn gpu_numa_node(&self, gpu_id: u32) -> Option<u32>
Get the NUMA node that a GPU is connected to.
Sourcepub fn cpus_for_gpu(&self, gpu_id: u32) -> Vec<u32>
pub fn cpus_for_gpu(&self, gpu_id: u32) -> Vec<u32>
Get CPUs on the same NUMA node as a given GPU.
Sourcepub fn select_cpu(
&self,
gpu_id: Option<u32>,
cpu_loads: &HashMap<u32, f32>,
) -> u32
pub fn select_cpu( &self, gpu_id: Option<u32>, cpu_loads: &HashMap<u32, f32>, ) -> u32
Select the best CPU for a task given its GPU affinity. Returns the CPU ID from the preferred NUMA node with the lowest load.
pub fn total_cpus(&self) -> usize
Trait Implementations§
Source§impl Clone for NumaTopology
impl Clone for NumaTopology
Source§fn clone(&self) -> NumaTopology
fn clone(&self) -> NumaTopology
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for NumaTopology
impl Debug for NumaTopology
Source§impl<'de> Deserialize<'de> for NumaTopology
impl<'de> Deserialize<'de> for NumaTopology
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for NumaTopology
impl RefUnwindSafe for NumaTopology
impl Send for NumaTopology
impl Sync for NumaTopology
impl Unpin for NumaTopology
impl UnwindSafe for NumaTopology
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more