MCPcopy Create free account
hub / github.com/NVIDIA/TensorRT-LLM / create_mpi_comm_session

Function create_mpi_comm_session

tensorrt_llm/executor/utils.py:48–65  ·  view source on GitHub ↗
(
        n_workers: int)

Source from the content-addressed store, hash-verified

46
47
48def create_mpi_comm_session(
49 n_workers: int) -> RemoteMpiCommSessionClient | MpiPoolSession:
50 assert mpi_rank(
51 ) == 0, f"create_mpi_comm_session must be called by rank 0, but it was called by rank {mpi_rank()}"
52 if get_spawn_proxy_process_env():
53 assert get_spawn_proxy_process_ipc_addr_env(
54 ), f"{LlmLauncherEnvs.TLLM_SPAWN_PROXY_PROCESS_IPC_ADDR} is not set."
55 logger_debug(
56 f"Using RemoteMpiPoolSessionClient to bind to external MPI processes at {get_spawn_proxy_process_ipc_addr_env()}\n",
57 "yellow")
58 hmac_key = get_spawn_proxy_process_ipc_hmac_key_env()
59 return RemoteMpiCommSessionClient(
60 addr=get_spawn_proxy_process_ipc_addr_env(), hmac_key=hmac_key)
61 else:
62 logger_debug(
63 f"Using MpiCommSession to bind to external MPI processes\n",
64 "yellow")
65 return MpiCommSession(n_workers=n_workers)
66
67
68def has_event_loop() -> bool:

Callers 3

__init__Method · 0.85
_create_mpi_sessionMethod · 0.85
__init__Method · 0.85

Calls 7

mpi_rankFunction · 0.90
logger_debugFunction · 0.85
MpiCommSessionClass · 0.85

Tested by

no test coverage detected