mirror of
https://github.com/clearml/go-nvlib
synced 2025-03-03 10:42:09 +00:00
Add numa node as a standard field in the nvpci struct
Signed-off-by: Kevin Klues <kklues@nvidia.com>
This commit is contained in:
parent
af7bde75a5
commit
5adc7bd87c
@ -61,6 +61,7 @@ type NvidiaPCIDevice struct {
|
|||||||
Vendor uint16
|
Vendor uint16
|
||||||
Class uint32
|
Class uint32
|
||||||
Device uint16
|
Device uint16
|
||||||
|
NumaNode int
|
||||||
Config *ConfigSpace
|
Config *ConfigSpace
|
||||||
Resources map[int]*MemoryResource
|
Resources map[int]*MemoryResource
|
||||||
}
|
}
|
||||||
@ -147,6 +148,16 @@ func (p *nvpci) GetAllDevices() ([]*NvidiaPCIDevice, error) {
|
|||||||
return nil, fmt.Errorf("unable to convert device string to uint16: %v", deviceStr)
|
return nil, fmt.Errorf("unable to convert device string to uint16: %v", deviceStr)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
numa, err := ioutil.ReadFile(path.Join(devicePath, "numa_node"))
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("unable to read PCI NUMA node for %s: %v", address, err)
|
||||||
|
}
|
||||||
|
numaStr := strings.TrimSpace(string(numa))
|
||||||
|
numaNode, err := strconv.ParseInt(numaStr, 0, 64)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("unable to convert NUMA node string to int64: %v", numaNode)
|
||||||
|
}
|
||||||
|
|
||||||
config := &ConfigSpace{
|
config := &ConfigSpace{
|
||||||
Path: path.Join(devicePath, "config"),
|
Path: path.Join(devicePath, "config"),
|
||||||
}
|
}
|
||||||
@ -183,6 +194,7 @@ func (p *nvpci) GetAllDevices() ([]*NvidiaPCIDevice, error) {
|
|||||||
Vendor: uint16(vendorID),
|
Vendor: uint16(vendorID),
|
||||||
Class: uint32(classID),
|
Class: uint32(classID),
|
||||||
Device: uint16(deviceID),
|
Device: uint16(deviceID),
|
||||||
|
NumaNode: int(numaNode),
|
||||||
Config: config,
|
Config: config,
|
||||||
Resources: resources,
|
Resources: resources,
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user