File tree Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -1290,7 +1290,7 @@ def _is_v1_supported_oracle(self, model_config: ModelConfig) -> bool:
12901290 # Skip this check if we are running on a non-GPU platform,
12911291 # or if the device capability is not available
12921292 # (e.g. in a Ray actor without GPUs).
1293- from vllm .platforms import current_platform
1293+ from vllm .platforms import CpuArchEnum , current_platform
12941294 if (current_platform .is_cuda ()
12951295 and current_platform .get_device_capability ()
12961296 and current_platform .get_device_capability ().major < 8 ):
@@ -1434,7 +1434,8 @@ def _is_v1_supported_oracle(self, model_config: ModelConfig) -> bool:
14341434 # Non-[CUDA, TPU] may be supported on V1, but off by default for now.
14351435 v0_hardware = not any (
14361436 (current_platform .is_cuda (), current_platform .is_tpu (),
1437- current_platform .is_cpu ()))
1437+ (current_platform .is_cpu ()
1438+ and current_platform .get_cpu_architecture () == CpuArchEnum .X86 )))
14381439 if v0_hardware and _warn_or_fallback ( # noqa: SIM103
14391440 current_platform .device_name ):
14401441 return False
Original file line number Diff line number Diff line change 22# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
33
44import os
5+ import platform
56import sys
67from importlib .util import find_spec
78from typing import TYPE_CHECKING , Optional
2223 VllmConfig = None
2324
2425
26+ def get_max_threads (pid = 0 ):
27+ if hasattr (os , 'sched_getaffinity' ):
28+ return len (os .sched_getaffinity (pid ))
29+ elif platform .system () == 'Darwin' :
30+ return os .cpu_count ()
31+ else :
32+ raise NotImplementedError ("Unsupported OS" )
33+
34+
2535class CpuPlatform (Platform ):
2636 _enum = PlatformEnum .CPU
2737 device_name : str = "cpu"
@@ -190,7 +200,7 @@ def check_and_update_config(cls, vllm_config: VllmConfig) -> None:
190200
191201 # Note: to avoid the error 'nthreads cannot be larger than environment
192202 # variable "NUMEXPR_MAX_THREADS" (64)'.
193- os .environ ["NUMEXPR_MAX_THREADS" ] = str (len ( os . sched_getaffinity ( 0 ) ))
203+ os .environ ["NUMEXPR_MAX_THREADS" ] = str (get_max_threads ( ))
194204
195205 # Set default threads num for OpenMP parallel
196206 os .environ ["OMP_NUM_THREADS" ] = str (torch .get_num_threads ())
You can’t perform that action at this time.
0 commit comments