@@ -36,16 +36,11 @@ cdef class MigInfo:
3636 Changing MIG modes may require device unbind or reset. The "pending" MIG
3737 mode refers to the target mode following the next activation trigger.
3838
39- If the device is not a MIG device , returns `False`.
40-
4139 Returns
4240 -------
4341 bool
4442 `True` if current MIG mode is enabled.
4543 """
46- if not self.is_mig_device:
47- return False
48-
4944 current , _ = nvml.device_get_mig_mode(self ._device._handle)
5045 return current == nvml.EnableState.FEATURE_ENABLED
5146
@@ -64,9 +59,6 @@ cdef class MigInfo:
6459 mode: bool
6560 `True` to enable MIG mode, `False` to disable MIG mode.
6661 """
67- if not self .is_mig_device:
68- raise ValueError (" Device is not a MIG device" )
69-
7062 nvml.device_set_mig_mode(
7163 self ._device._handle,
7264 nvml.EnableState.FEATURE_ENABLED if mode else nvml.EnableState.FEATURE_DISABLED
@@ -89,9 +81,6 @@ cdef class MigInfo:
8981 bool
9082 `True` if pending MIG mode is enabled.
9183 """
92- if not self.is_mig_device:
93- return False
94-
9584 _ , pending = nvml.device_get_mig_mode(self ._device._handle)
9685 return pending == nvml.EnableState.FEATURE_ENABLED
9786
@@ -123,7 +112,7 @@ cdef class MigInfo:
123112 Device
124113 The parent GPU device for this MIG device.
125114 """
126- parent_handle = nvml.device_get_handle_from_mig_device_handle(self ._handle)
115+ parent_handle = nvml.device_get_handle_from_mig_device_handle(self ._device. _handle)
127116 parent_device = Device.__new__ (Device)
128117 parent_device._handle = parent_handle
129118 return parent_device
@@ -144,7 +133,7 @@ cdef class MigInfo:
144133 ----------
145134 index: int
146135 The index of the MIG device (compute instance ) to retrieve. Must be
147- between 0 and the value returned by `get_device_count() - 1`.
136+ between 0 and the value returned by `device_count - 1`.
148137
149138 Returns
150139 -------
@@ -173,5 +162,5 @@ cdef class MigInfo:
173162 list[Device]
174163 A list of all MIG devices corresponding to this GPU.
175164 """
176- for i in range(self.get_device_count() ):
165+ for i in range(self.device_count ):
177166 yield self .get_device_by_index(i)
0 commit comments