Skip to content

Commit dfb3226

Browse files
authored
Use device_id in dist init to reduce NCCL communicator warmup & creation overhead (#5728)
1 parent 63c13a2 commit dfb3226

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

python/sglang/srt/distributed/parallel_state.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1055,6 +1055,11 @@ def init_distributed_environment(
10551055
world_size=world_size,
10561056
rank=rank,
10571057
timeout=timeout,
1058+
device_id=torch.device(
1059+
f"cuda:{torch.cuda.current_device()}"
1060+
if hasattr(torch, "cuda") and torch.cuda.is_available()
1061+
else None
1062+
), # Allow NCCL to eagerly init communicator
10581063
)
10591064

10601065
# set the local rank

0 commit comments

Comments
 (0)