@@ -19,7 +19,7 @@ package mig
19
19
import (
20
20
"fmt"
21
21
22
- "github.com/NVIDIA/mig-parted/internal /nvml"
22
+ "github.com/NVIDIA/go-nvml/pkg /nvml"
23
23
)
24
24
25
25
type Interface struct {
@@ -52,10 +52,10 @@ func (i Interface) GpuInstance(gi nvml.GpuInstance) GpuInstance {
52
52
53
53
func (device Device ) AssertMigEnabled () error {
54
54
mode , _ , ret := device .GetMigMode ()
55
- if ret . Value () == nvml .ERROR_NOT_SUPPORTED {
55
+ if ret == nvml .ERROR_NOT_SUPPORTED {
56
56
return fmt .Errorf ("MIG not supported" )
57
57
}
58
- if ret . Value () != nvml .SUCCESS {
58
+ if ret != nvml .SUCCESS {
59
59
return fmt .Errorf ("error getting MIG mode: %v" , ret )
60
60
}
61
61
if mode != nvml .DEVICE_MIG_ENABLE {
@@ -67,18 +67,18 @@ func (device Device) AssertMigEnabled() error {
67
67
func (device Device ) WalkGpuInstances (f func (nvml.GpuInstance , int , nvml.GpuInstanceProfileInfo ) error ) error {
68
68
for i := 0 ; i < nvml .GPU_INSTANCE_PROFILE_COUNT ; i ++ {
69
69
giProfileInfo , ret := device .GetGpuInstanceProfileInfo (i )
70
- if ret . Value () == nvml .ERROR_NOT_SUPPORTED {
70
+ if ret == nvml .ERROR_NOT_SUPPORTED {
71
71
continue
72
72
}
73
- if ret . Value () == nvml .ERROR_INVALID_ARGUMENT {
73
+ if ret == nvml .ERROR_INVALID_ARGUMENT {
74
74
continue
75
75
}
76
- if ret . Value () != nvml .SUCCESS {
76
+ if ret != nvml .SUCCESS {
77
77
return fmt .Errorf ("error getting GPU instance profile info for '%v': %v" , i , ret )
78
78
}
79
79
80
80
gis , ret := device .GetGpuInstances (& giProfileInfo )
81
- if ret . Value () != nvml .SUCCESS {
81
+ if ret != nvml .SUCCESS {
82
82
return fmt .Errorf ("error getting GPU instances for profile '%v': %v" , i , ret )
83
83
}
84
84
@@ -96,18 +96,18 @@ func (gi GpuInstance) WalkComputeInstances(f func(ci nvml.ComputeInstance, ciPro
96
96
for j := 0 ; j < nvml .COMPUTE_INSTANCE_PROFILE_COUNT ; j ++ {
97
97
for k := 0 ; k < nvml .COMPUTE_INSTANCE_ENGINE_PROFILE_COUNT ; k ++ {
98
98
ciProfileInfo , ret := gi .GetComputeInstanceProfileInfo (j , k )
99
- if ret . Value () == nvml .ERROR_NOT_SUPPORTED {
99
+ if ret == nvml .ERROR_NOT_SUPPORTED {
100
100
continue
101
101
}
102
- if ret . Value () == nvml .ERROR_INVALID_ARGUMENT {
102
+ if ret == nvml .ERROR_INVALID_ARGUMENT {
103
103
continue
104
104
}
105
- if ret . Value () != nvml .SUCCESS {
105
+ if ret != nvml .SUCCESS {
106
106
return fmt .Errorf ("error getting Compute instance profile info for '(%v, %v)': %v" , j , k , ret )
107
107
}
108
108
109
109
cis , ret := gi .GetComputeInstances (& ciProfileInfo )
110
- if ret . Value () != nvml .SUCCESS {
110
+ if ret != nvml .SUCCESS {
111
111
return fmt .Errorf ("error getting Compute instances for profile '(%v, %v)': %v" , j , k , ret )
112
112
}
113
113
0 commit comments