Commit 5d685060 authored by Ubuntu's avatar Ubuntu

fix gpu

parent 7a2c46e8
...@@ -24,7 +24,7 @@ func getGPU() ([]DeviceInfo, error) { ...@@ -24,7 +24,7 @@ func getGPU() ([]DeviceInfo, error) {
log.Fatalf("Unable to get device count: %v", nvml.ErrorString(ret)) log.Fatalf("Unable to get device count: %v", nvml.ErrorString(ret))
} }
res := make([]DeviceInfo, 0, len(count)) res := make([]DeviceInfo, 0, count)
for i := 0; i < count; i++ { for i := 0; i < count; i++ {
...@@ -33,10 +33,10 @@ func getGPU() ([]DeviceInfo, error) { ...@@ -33,10 +33,10 @@ func getGPU() ([]DeviceInfo, error) {
log.Fatalf("Unable to get device at index %d: %v", i, nvml.ErrorString(ret)) log.Fatalf("Unable to get device at index %d: %v", i, nvml.ErrorString(ret))
} }
memory, err := device.GetMemoryInfo() // memory, err := device.GetMemoryInfo()
if err != nvml.SUCCESS { // if err != nvml.SUCCESS {
panic(err) // panic(err)
} // }
// d1, _, err := device.GetDriverModel() // d1, _, err := device.GetDriverModel()
// if err != nvml.SUCCESS { // if err != nvml.SUCCESS {
...@@ -48,13 +48,18 @@ func getGPU() ([]DeviceInfo, error) { ...@@ -48,13 +48,18 @@ func getGPU() ([]DeviceInfo, error) {
panic(err) panic(err)
} }
memory, err := device.GetMemoryInfo()
if err != nvml.SUCCESS {
fmt.Println(err)
}
//fmt.Printf(" %v\n", proc) //fmt.Printf(" %v\n", proc)
e := DeviceInfo{ e := DeviceInfo{
Type: fmt.Sprintf("GPU-%d", i), Type: fmt.Sprintf("GPU-%d", i),
Model: name, Model: name,
Param: "device.GetMemoryInfo()", Param: "device.GetMemoryInfo()",
Power: uint64(device.GetMemoryInfo()), Power: uint64(memory.Total),
} }
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