Fix GPU index numbering, promote the GPU ID

This commit is contained in:
Ingo Oppermann
2024-10-31 14:59:22 +01:00
parent bfb54ca177
commit d591a2383e
5 changed files with 21 additions and 19 deletions

View File

@@ -71,6 +71,7 @@ type CPUInfo struct {
type GPUInfo struct {
Index int // Index of the GPU
ID string // Physical ID of the GPU (not populated for a specific process)
Name string // Name of the GPU (not populated for a specific process)
MemoryTotal uint64 // bytes (not populated for a specific process)
@@ -638,8 +639,10 @@ func (u *util) GPU() ([]GPUInfo, error) {
stats := []GPUInfo{}
for _, nv := range nvstats {
for i, nv := range nvstats {
stats = append(stats, GPUInfo{
Index: i,
ID: nv.ID,
Name: nv.Name,
MemoryTotal: nv.MemoryTotal,
MemoryUsed: nv.MemoryUsed,