torchtnt.utils.distributed.get_tcp_init_method¶
-
torchtnt.utils.distributed.
get_tcp_init_method
(*, world_size: Optional[int] = None, rank: Optional[int] = None, hostname: Optional[str] = None, port: Optional[int] = None) str ¶ Gets init method for the TCP protocol for the distributed environment. For more information, see here: https://pytorch.org/docs/stable/distributed.html#tcp-initialization.
Parameters: - world_size – global number of workers. If
None
, the default is fetched using :function:`get_world_size`. - rank – Global rank of the worker calling the function. If
None
, the default is fetched using :function:`get_global_rank`. - hostname – an address that belongs to the rank 0 process. If
None
, thenlocalhost
is used. - port – A free port to use for communication. If
None
, this port is automatically selected.
- world_size – global number of workers. If