A high-throughput and memory-efficient inference and serving engine for LLMs
Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git
Synced Nov 4, 06:15 UTC
[BugFix][MyPy]: Module has no attribute "sched_getaffinity" [attr-defined] (#41465)
Signed-off-by: Martin Hickey <martin.hickey@ie.ibm.com>
Martin Hickey committed
May 5, 2026 at 14:20 UTC
6fca51815706fbb0735849b95c0dafa05da20f9f
1 file changed
+8
-11
vllm/utils/cpu_resource_utils.py
+8
-11
@@ -3,8 +3,8 @@
3
4
import json
5
import os
6
-import platform
6
import subprocess
7
+import sys
8
from dataclasses import dataclass
9
from functools import cache
10
@@ -78,7 +78,7 @@ def parse_id_list(raw_str: str) -> list[int]:
78
79
80
def get_memory_node_info(node_id: int = 0) -> MemoryNodeInfo:
81
- if platform.system() == "Darwin":
81
+ if sys.platform == "darwin":
82
# MacOS has no memory node
83
return MemoryNodeInfo(
84
total_memory=psutil.virtual_memory().total,
@@ -122,17 +122,14 @@ def get_memory_node_info(node_id: int = 0) -> MemoryNodeInfo:
122
123
def get_allowed_cpu_list() -> list[LogicalCPUInfo]:
124
cpu_list = _get_cpu_list()
125
- if platform.system() == "Darwin":
126
- return cpu_list
127
-
128
- global_allowed_cpu_id_list = os.sched_getaffinity(0) # type: ignore[attr-defined]
129
- logical_cpu_list = [x for x in cpu_list if x.id in global_allowed_cpu_id_list]
130
-
131
- return logical_cpu_list
125
+ if sys.platform == "linux":
126
+ allowed = os.sched_getaffinity(0)
127
+ return [x for x in cpu_list if x.id in allowed]
128
+ return cpu_list
129
130
131
def get_visible_memory_node() -> list[int]:
135
- if platform.system() == "Darwin":
132
+ if sys.platform == "darwin":
133
return [0]
134
135
allowed_memory_node_list = get_memory_affinity()
@@ -163,7 +160,7 @@ def _synthesize_cpu_list() -> list[LogicalCPUInfo]:
160
161
162
def _get_cpu_list() -> list[LogicalCPUInfo]:
166
- if platform.system() == "Darwin":
163
+ if sys.platform == "darwin":
164
# For MacOS, no user-level CPU affinity and SMT, return all CPUs
165
return _synthesize_cpu_list()
166