Skip to content

Commit 58b4b21

Browse files
committed
Address comments in PR
1 parent ad7fd63 commit 58b4b21

3 files changed

Lines changed: 7 additions & 17 deletions

File tree

cuda_core/cuda/core/system/_device.pyx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ cdef class Device:
149149
prefix. This property returns it without the prefix, to match the UUIDs
150150
used in CUDA. If you need the prefix, use the `uuid` property.
151151
"""
152-
# NVML UUIDs have a `GPU-` or `MIG-` prefix. We remove that here.
152+
# NVML UUIDs have a `gpu-` or `mig-` prefix. We remove that here.
153153
return nvml.device_get_uuid(self._handle)[4:]
154154

155155
@property
@@ -339,7 +339,7 @@ cdef class Device:
339339
@property
340340
def mig(self) -> MigInfo:
341341
"""
342-
Accessor for MIG (Multi-Instance GPU) information.
342+
Get :obj:`~MigInfo` accessor for MIG (Multi-Instance GPU) information.
343343

344344
For Ampere™ or newer fully supported devices.
345345
"""

cuda_core/cuda/core/system/_mig.pxi

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -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)

cuda_core/docs/source/api_private.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.. SPDX-FileCopyrightText: Copyright (c) 2024-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
1+
.. SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
22
.. SPDX-License-Identifier: Apache-2.0
33
44
:orphan:
@@ -76,6 +76,7 @@ NVML
7676
system._device.GpuTopologyLevel
7777
system._device.InforomInfo
7878
system._device.MemoryInfo
79+
system._device.MigInfo
7980
system._device.PciInfo
8081
system._device.RepairStatus
8182
system._device.Temperature

0 commit comments

Comments
 (0)