[Ray] Bind scheduler actors to GPU-local NUMA node (#22989)
Co-authored-by: xyuzh <xyuzh@users.noreply.github.com>
This commit is contained in:
@@ -50,7 +50,12 @@ class SchedulerActor:
|
|||||||
):
|
):
|
||||||
import dataclasses
|
import dataclasses
|
||||||
|
|
||||||
from sglang.srt.managers.scheduler import Scheduler, configure_scheduler
|
from sglang.srt.environ import envs
|
||||||
|
from sglang.srt.managers.scheduler import Scheduler, configure_scheduler_process
|
||||||
|
from sglang.srt.utils.numa_utils import (
|
||||||
|
get_numa_node_if_available,
|
||||||
|
numa_bind_to_node,
|
||||||
|
)
|
||||||
|
|
||||||
# Override dist_init_addr if provided (for multi-node)
|
# Override dist_init_addr if provided (for multi-node)
|
||||||
if dist_init_addr:
|
if dist_init_addr:
|
||||||
@@ -72,8 +77,9 @@ class SchedulerActor:
|
|||||||
logger.info(f"[TP{tp_rank}] Using passed gpu_id: {gpu_id}")
|
logger.info(f"[TP{tp_rank}] Using passed gpu_id: {gpu_id}")
|
||||||
|
|
||||||
# Configure worker (logging, process title, etc.)
|
# Configure worker (logging, process title, etc.)
|
||||||
dp_rank = configure_scheduler(
|
dp_rank = configure_scheduler_process(
|
||||||
server_args,
|
server_args,
|
||||||
|
actual_gpu_id,
|
||||||
tp_rank,
|
tp_rank,
|
||||||
attn_cp_rank,
|
attn_cp_rank,
|
||||||
moe_dp_rank,
|
moe_dp_rank,
|
||||||
@@ -82,6 +88,18 @@ class SchedulerActor:
|
|||||||
dp_rank,
|
dp_rank,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Ray actors can't use the numactl subprocess-wrapping approach
|
||||||
|
# (SGLANG_NUMA_BIND_V2's normal path), so bind in-process via libnuma.
|
||||||
|
# The V1 path inside configure_scheduler_process already handles
|
||||||
|
# SGLANG_NUMA_BIND_V2=False.
|
||||||
|
if envs.SGLANG_NUMA_BIND_V2.get():
|
||||||
|
numa_node = get_numa_node_if_available(server_args, actual_gpu_id)
|
||||||
|
if numa_node is not None:
|
||||||
|
numa_bind_to_node(numa_node)
|
||||||
|
logger.info(
|
||||||
|
f"[TP{tp_rank}] Bound to NUMA node {numa_node} for GPU {actual_gpu_id}"
|
||||||
|
)
|
||||||
|
|
||||||
# Create scheduler (loads model into GPU, initializes NCCL)
|
# Create scheduler (loads model into GPU, initializes NCCL)
|
||||||
self.scheduler = Scheduler(
|
self.scheduler = Scheduler(
|
||||||
server_args=server_args,
|
server_args=server_args,
|
||||||
|
|||||||
Reference in New Issue
Block a user