Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
change
sglang
Commits
0fe87213
"src/libtorio/ffmpeg/stream_writer/encoder.h" did not exist on "ea78478ed82daea4900c9c4f02cb0ff91a5c407a"
Unverified
Commit
0fe87213
authored
Oct 10, 2025
by
Yingchun Lai
Committed by
GitHub
Oct 09, 2025
Browse files
fix: fix gpu-proc affinity set incorrectly when pp_size > 1 (#11389)
parent
1f106ee3
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
3 deletions
+9
-3
python/sglang/bench_one_batch.py
python/sglang/bench_one_batch.py
+3
-1
python/sglang/srt/managers/scheduler.py
python/sglang/srt/managers/scheduler.py
+3
-1
python/sglang/srt/utils/common.py
python/sglang/srt/utils/common.py
+3
-1
No files found.
python/sglang/bench_one_batch.py
View file @
0fe87213
...
...
@@ -510,7 +510,9 @@ def latency_test(
# Set CPU affinity
if
get_bool_env_var
(
"SGLANG_SET_CPU_AFFINITY"
):
set_gpu_proc_affinity
(
server_args
.
tp_size
,
server_args
.
nnodes
,
tp_rank
)
set_gpu_proc_affinity
(
server_args
.
pp_size
,
server_args
.
tp_size
,
server_args
.
nnodes
,
tp_rank
)
# Configure the logger
configure_logger
(
server_args
,
prefix
=
f
" TP
{
tp_rank
}
"
)
...
...
python/sglang/srt/managers/scheduler.py
View file @
0fe87213
...
...
@@ -2921,7 +2921,9 @@ def run_scheduler_process(
# Set cpu affinity to this gpu process
if
get_bool_env_var
(
"SGLANG_SET_CPU_AFFINITY"
):
set_gpu_proc_affinity
(
server_args
.
tp_size
,
server_args
.
nnodes
,
gpu_id
)
set_gpu_proc_affinity
(
server_args
.
pp_size
,
server_args
.
tp_size
,
server_args
.
nnodes
,
gpu_id
)
if
(
numa_node
:
=
server_args
.
numa_node
)
is
not
None
:
numa_bind_to_node
(
numa_node
[
gpu_id
])
...
...
python/sglang/srt/utils/common.py
View file @
0fe87213
...
...
@@ -1891,6 +1891,7 @@ def direct_register_custom_op(
def
set_gpu_proc_affinity
(
pp_size
:
int
,
tp_size
:
int
,
nnodes
:
int
,
gpu_id
:
int
,
...
...
@@ -1899,7 +1900,8 @@ def set_gpu_proc_affinity(
pid
=
os
.
getpid
()
p
=
psutil
.
Process
(
pid
)
tp_size_per_node
=
tp_size
//
nnodes
nnodes_per_tp_group
=
max
(
nnodes
//
pp_size
,
1
)
tp_size_per_node
=
tp_size
//
nnodes_per_tp_group
# total physical cores
total_pcores
=
psutil
.
cpu_count
(
logical
=
False
)
...
...
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