Commit 175afe93 authored by Ubuntu's avatar Ubuntu

add gpu usage

parent 217cf967
...@@ -16,7 +16,8 @@ func getGPU() ([]DeviceInfo, error) { ...@@ -16,7 +16,8 @@ func getGPU() ([]DeviceInfo, error) {
defer func() { defer func() {
ret := nvml.Shutdown() ret := nvml.Shutdown()
if ret != nvml.SUCCESS { if ret != nvml.SUCCESS {
return nil, fmt.Errorf(nvml.ErrorString(ret)) fmt.Println("defer", nvml.ErrorString(ret))
//return nil, fmt.Errorf(nvml.ErrorString(ret))
} }
}() }()
...@@ -104,7 +105,9 @@ func getGpuUsage() ([]DeviceInfo, error) { ...@@ -104,7 +105,9 @@ func getGpuUsage() ([]DeviceInfo, error) {
defer func() { defer func() {
ret := nvml.Shutdown() ret := nvml.Shutdown()
if ret != nvml.SUCCESS { if ret != nvml.SUCCESS {
return nil, fmt.Errorf(nvml.ErrorString(ret)) fmt.Println("defer", nvml.ErrorString(ret))
//return nil, fmt.Errorf(nvml.ErrorString(ret))
//log.Fatalf("Unable to shutdown NVML: %v", nvml.ErrorString(ret)) //log.Fatalf("Unable to shutdown NVML: %v", nvml.ErrorString(ret))
} }
}() }()
...@@ -141,7 +144,7 @@ func getGpuUsage() ([]DeviceInfo, error) { ...@@ -141,7 +144,7 @@ func getGpuUsage() ([]DeviceInfo, error) {
Type: fmt.Sprintf("GPU-%d", i), Type: fmt.Sprintf("GPU-%d", i),
Model: name, Model: name,
Param: "gpu usage", Param: "gpu usage",
Power: utilization.Gpu, Power: uint64(utilization.Gpu),
} }
res = append(res, e) res = append(res, e)
...@@ -150,7 +153,7 @@ func getGpuUsage() ([]DeviceInfo, error) { ...@@ -150,7 +153,7 @@ func getGpuUsage() ([]DeviceInfo, error) {
Type: fmt.Sprintf("GPU-%d", i), Type: fmt.Sprintf("GPU-%d", i),
Model: name, Model: name,
Param: "gpu mem usage", Param: "gpu mem usage",
Power: utilization.Memory, Power: uint64(utilization.Memory),
} }
res = append(res, e) res = append(res, e)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment