Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenDAS
vllm_cscc
Commits
ef3f98b5
Unverified
Commit
ef3f98b5
authored
Jun 05, 2025
by
Kebe
Committed by
GitHub
Jun 04, 2025
Browse files
[Bugfix] fix v1 cpu worker fails on macOS (#19121)
parent
7ee25904
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
3 deletions
+14
-3
vllm/engine/arg_utils.py
vllm/engine/arg_utils.py
+3
-2
vllm/platforms/cpu.py
vllm/platforms/cpu.py
+11
-1
No files found.
vllm/engine/arg_utils.py
View file @
ef3f98b5
...
@@ -1290,7 +1290,7 @@ class EngineArgs:
...
@@ -1290,7 +1290,7 @@ class EngineArgs:
# Skip this check if we are running on a non-GPU platform,
# Skip this check if we are running on a non-GPU platform,
# or if the device capability is not available
# or if the device capability is not available
# (e.g. in a Ray actor without GPUs).
# (e.g. in a Ray actor without GPUs).
from
vllm.platforms
import
current_platform
from
vllm.platforms
import
CpuArchEnum
,
current_platform
if
(
current_platform
.
is_cuda
()
if
(
current_platform
.
is_cuda
()
and
current_platform
.
get_device_capability
()
and
current_platform
.
get_device_capability
()
and
current_platform
.
get_device_capability
().
major
<
8
):
and
current_platform
.
get_device_capability
().
major
<
8
):
...
@@ -1434,7 +1434,8 @@ class EngineArgs:
...
@@ -1434,7 +1434,8 @@ class EngineArgs:
# Non-[CUDA, TPU] may be supported on V1, but off by default for now.
# Non-[CUDA, TPU] may be supported on V1, but off by default for now.
v0_hardware
=
not
any
(
v0_hardware
=
not
any
(
(
current_platform
.
is_cuda
(),
current_platform
.
is_tpu
(),
(
current_platform
.
is_cuda
(),
current_platform
.
is_tpu
(),
current_platform
.
is_cpu
()))
(
current_platform
.
is_cpu
()
and
current_platform
.
get_cpu_architecture
()
==
CpuArchEnum
.
X86
)))
if
v0_hardware
and
_warn_or_fallback
(
# noqa: SIM103
if
v0_hardware
and
_warn_or_fallback
(
# noqa: SIM103
current_platform
.
device_name
):
current_platform
.
device_name
):
return
False
return
False
...
...
vllm/platforms/cpu.py
View file @
ef3f98b5
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
import
os
import
os
import
platform
import
sys
import
sys
from
importlib.util
import
find_spec
from
importlib.util
import
find_spec
from
typing
import
TYPE_CHECKING
,
Optional
from
typing
import
TYPE_CHECKING
,
Optional
...
@@ -22,6 +23,15 @@ else:
...
@@ -22,6 +23,15 @@ else:
VllmConfig
=
None
VllmConfig
=
None
def
get_max_threads
(
pid
=
0
):
if
hasattr
(
os
,
'sched_getaffinity'
):
return
len
(
os
.
sched_getaffinity
(
pid
))
elif
platform
.
system
()
==
'Darwin'
:
return
os
.
cpu_count
()
else
:
raise
NotImplementedError
(
"Unsupported OS"
)
class
CpuPlatform
(
Platform
):
class
CpuPlatform
(
Platform
):
_enum
=
PlatformEnum
.
CPU
_enum
=
PlatformEnum
.
CPU
device_name
:
str
=
"cpu"
device_name
:
str
=
"cpu"
...
@@ -190,7 +200,7 @@ class CpuPlatform(Platform):
...
@@ -190,7 +200,7 @@ class CpuPlatform(Platform):
# Note: to avoid the error 'nthreads cannot be larger than environment
# Note: to avoid the error 'nthreads cannot be larger than environment
# variable "NUMEXPR_MAX_THREADS" (64)'.
# variable "NUMEXPR_MAX_THREADS" (64)'.
os
.
environ
[
"NUMEXPR_MAX_THREADS"
]
=
str
(
len
(
os
.
sched_getaffinity
(
0
)
))
os
.
environ
[
"NUMEXPR_MAX_THREADS"
]
=
str
(
get_max_threads
(
))
# Set default threads num for OpenMP parallel
# Set default threads num for OpenMP parallel
os
.
environ
[
"OMP_NUM_THREADS"
]
=
str
(
torch
.
get_num_threads
())
os
.
environ
[
"OMP_NUM_THREADS"
]
=
str
(
torch
.
get_num_threads
())
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment