MSCCL++ Integration (#22734)
Co-authored-by: Caio Rocha <caiorocha@microsof.com> Co-authored-by: empyreus <rjsouza1995@gmail.com>
This commit is contained in:
co-authored by
Caio Rocha
empyreus
parent
9c53031d2b
commit
c2eae96c56
@@ -65,7 +65,10 @@ import torch
|
||||
import torch.distributed as dist
|
||||
|
||||
from sglang.srt.configs.model_config import ModelConfig
|
||||
from sglang.srt.distributed.parallel_state import destroy_distributed_environment
|
||||
from sglang.srt.distributed.parallel_state import (
|
||||
destroy_distributed_environment,
|
||||
destroy_model_parallel,
|
||||
)
|
||||
from sglang.srt.entrypoints.engine import _set_envs_and_config
|
||||
from sglang.srt.layers.dp_attention import get_attention_tp_size
|
||||
from sglang.srt.layers.moe import initialize_moe_config
|
||||
@@ -936,6 +939,7 @@ def latency_test(
|
||||
fout.write(json.dumps(result) + "\n")
|
||||
|
||||
if server_args.tp_size > 1:
|
||||
destroy_model_parallel()
|
||||
destroy_distributed_environment()
|
||||
|
||||
|
||||
@@ -957,12 +961,17 @@ def main(server_args, bench_args):
|
||||
|
||||
port_args = PortArgs.init_new(server_args)
|
||||
|
||||
# Calculate local ranks for multi-node setup
|
||||
nranks_per_node = server_args.tp_size // server_args.nnodes
|
||||
local_rank_start = server_args.node_rank * nranks_per_node
|
||||
local_rank_end = local_rank_start + nranks_per_node
|
||||
|
||||
if server_args.tp_size == 1:
|
||||
work_func(server_args, port_args, bench_args, 0, 0)
|
||||
else:
|
||||
workers = []
|
||||
for tp_rank in range(server_args.tp_size):
|
||||
with maybe_reindex_device_id(tp_rank) as gpu_id:
|
||||
for tp_rank in range(local_rank_start, local_rank_end):
|
||||
with maybe_reindex_device_id(tp_rank - local_rank_start) as gpu_id:
|
||||
proc = multiprocessing.Process(
|
||||
target=work_func,
|
||||
args=(
|
||||
|
||||
Reference in New Issue
Block a user