Skip to content

Commit 12b4e13

Browse files
committed
fix: failed to get minor number
Signed-off-by: thxCode <thxcode0824@gmail.com>
1 parent 5061814 commit 12b4e13

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

gpustack_runtime/detector/iluvatar.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,8 @@ def detect(self) -> Devices | None:
124124

125125
dev_index = dev_idx
126126
if envs.GPUSTACK_RUNTIME_DETECT_PHYSICAL_INDEX_PRIORITY:
127-
dev_index = pyixml.nvmlDeviceGetMinorNumber(dev)
127+
with contextlib.suppress(pyixml.NVMLError):
128+
dev_index = pyixml.nvmlDeviceGetMinorNumber(dev)
128129

129130
dev_name = pyixml.nvmlDeviceGetName(dev)
130131

gpustack_runtime/detector/nvidia.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,8 @@ def detect(self) -> Devices | None: # noqa: PLR0915
164164

165165
dev_index = dev_idx
166166
if envs.GPUSTACK_RUNTIME_DETECT_PHYSICAL_INDEX_PRIORITY:
167-
dev_index = pynvml.nvmlDeviceGetMinorNumber(dev)
167+
with contextlib.suppress(pynvml.NVMLError):
168+
dev_index = pynvml.nvmlDeviceGetMinorNumber(dev)
168169

169170
# With MIG disabled, treat as a single device.
170171

gpustack_runtime/detector/thead.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,8 @@ def detect(self) -> Devices | None:
162162

163163
dev_index = dev_idx
164164
if envs.GPUSTACK_RUNTIME_DETECT_PHYSICAL_INDEX_PRIORITY:
165-
dev_index = pyhgml.hgmlDeviceGetMinorNumber(dev)
165+
with contextlib.suppress(pyhgml.HGMLError):
166+
dev_index = pyhgml.hgmlDeviceGetMinorNumber(dev)
166167

167168
# With MIG disabled, treat as a single device.
168169

0 commit comments

Comments
 (0)