Skip to main content

get_device_numa_node

Function get_device_numa_node 

Source
pub fn get_device_numa_node(device_id: u32) -> Option<NumaNode>
Expand description

Get NUMA node for a GPU device.

Queries the PCI bus address from the CUDA driver API, then reads the NUMA node from sysfs. Falls back to nvidia-smi with the PCI address. Returns None if the NUMA node cannot be determined, signaling the caller to skip NUMA-aware allocation entirely rather than guessing wrong.

CUDA_VISIBLE_DEVICES is handled transparently because CudaContext::new(ordinal) operates on the process-local device index.

§Arguments

  • device_id - CUDA device index (0, 1, 2, …) as seen by the process

§Returns

The NUMA node closest to the specified GPU, or None if it cannot be determined.