Utilities#
Created On: Oct 15, 2026 | Last Updated On: Oct 15, 2026
- torch.distributed.elastic.utils.api.get_env_variable_or_raise(env_name)[source]#
Tries to retrieve environment variable. Raises
ValueErrorif no environment variable found.
- torch.distributed.elastic.utils.distributed.get_free_port()[source]#
Returns a port that is unused on all local addresses.
This function finds an unused port by binding a socket to the wildcard address and then closing it.
- Returns:
a port that is unused on all local addresses
- Return type:
Example
>>> get_free_port() 63976
Note
The port returned by
get_free_port()is not reserved and may be taken by another process after this function returns.
- torch.distributed.elastic.utils.log_level.get_log_level()[source]#
Return default log level for pytorch.
- Return type: