[Log] Optimize Startup Log (#26740)

Signed-off-by: yewentao256 <zhyanwentao@126.com>
This commit is contained in:
Wentao Ye
2025-10-24 19:27:04 -04:00
committed by GitHub
parent d95d0f4b98
commit 52efc34ebf
21 changed files with 151 additions and 63 deletions
@@ -13,7 +13,6 @@ from vllm.distributed.device_communicators.pynccl import register_nccl_symmetric
from vllm.distributed.device_communicators.pynccl_allocator import (
is_symmetric_memory_enabled,
)
from vllm.distributed.parallel_state import is_global_first_rank
from vllm.logger import init_logger
from vllm.platforms import current_platform
@@ -118,11 +117,11 @@ class CudaCommunicator(DeviceCommunicatorBase):
else:
raise ValueError(f"Unknown all2all backend: {self.all2all_backend}")
if is_global_first_rank():
logger.info(
"Using %s all2all manager.",
self.all2all_manager.__class__.__name__,
)
logger.info_once(
"Using %s all2all manager.",
self.all2all_manager.__class__.__name__,
scope="global",
)
def all_reduce(self, input_):
# since currently we perform copy input -> symm_input -> out-of-place AR
@@ -34,7 +34,7 @@ def _can_p2p(rank: int, world_size: int) -> bool:
if i == rank:
continue
if envs.VLLM_SKIP_P2P_CHECK:
logger.info("Skipping P2P check and trusting the driver's P2P report.")
logger.debug("Skipping P2P check and trusting the driver's P2P report.")
return torch.cuda.can_device_access_peer(rank, i)
if not gpu_p2p_access_check(rank, i):
return False
@@ -108,7 +108,9 @@ class PyNcclCommunicator:
if self.rank == 0:
# get the unique id from NCCL
self.unique_id = self.nccl.ncclGetUniqueId()
logger.info("vLLM is using nccl==%s", self.nccl.ncclGetVersion())
logger.info_once(
"vLLM is using nccl==%s", self.nccl.ncclGetVersion(), scope="local"
)
else:
# construct an empty unique id
self.unique_id = ncclUniqueId()
@@ -312,7 +312,7 @@ class MessageQueue:
remote_addr_ipv6=remote_addr_ipv6,
)
logger.info("vLLM message queue communication handle: %s", self.handle)
logger.debug("vLLM message queue communication handle: %s", self.handle)
def export_handle(self) -> Handle:
return self.handle
+25 -2
View File
@@ -1157,7 +1157,7 @@ def init_distributed_environment(
ip = parallel_config.data_parallel_master_ip
port = parallel_config.get_next_dp_init_port()
distributed_init_method = get_distributed_init_method(ip, port)
logger.info(
logger.debug(
"Adjusting world_size=%d rank=%d distributed_init_method=%s for DP",
world_size,
rank,
@@ -1322,7 +1322,7 @@ def initialize_model_parallel(
group_ranks, get_world_group().local_rank, backend, group_name="ep"
)
logger.info(
logger.info_once(
"rank %s in world size %s is assigned as "
"DP rank %s, PP rank %s, TP rank %s, EP rank %s",
rank,
@@ -1625,6 +1625,29 @@ def is_global_first_rank() -> bool:
return True
def is_local_first_rank() -> bool:
"""
Check if the current process is the first local rank (rank 0 on its node).
"""
try:
# prefer the initialized world group if available
global _WORLD
if _WORLD is not None:
return _WORLD.local_rank == 0
if not torch.distributed.is_initialized():
return True
# fallback to environment-provided local rank if available
# note: envs.LOCAL_RANK is set when using env:// launchers (e.g., torchrun)
try:
return int(envs.LOCAL_RANK) == 0 # type: ignore[arg-type]
except Exception:
return torch.distributed.get_rank() == 0
except Exception:
return True
def _node_count(pg: ProcessGroup | StatelessProcessGroup) -> int:
"""
Returns the total number of nodes in the process group.