nemo_automodel.components.distributed.init_utils
nemo_automodel.components.distributed.init_utils
Module Contents
Classes
Functions
API
Holds information about the distributed training environment.
Destroy the torch.distributed process group during cleanup.
This function is registered to execute at exit to ensure the process group is properly destroyed. It temporarily ignores SIGINT to avoid interruption during cleanup.
For MoE runs that use DeepEP, the process-global DeepEP Buffer (NVSHMEM symmetric memory
plus its own NCCL sub-groups) is destroyed before destroy_process_group(). Tearing the
buffer down first releases that pending collective state; otherwise destroy_process_group()
hangs on it. Freeing the buffer is a no-op when DeepEP was never used.
Get the local rank from the environment variable, intended for use before full init.
Returns: int
The local rank of the current process.
Get the local world size from the environment variable, intended for use before full init.
Returns: int
The local world size of the current process.
Get the distributed rank safely, even if torch.distributed is not initialized.
Returns: int
The current process rank.
Get the distributed world size safely, even if torch.distributed is not initialized.
Returns: int
The total number of processes in the distributed job.
Initialize the torch.distributed environment and core model parallel infrastructure.
This function sets the device based on the local rank, configures the process group, and calls torch.distributed.init_process_group with the appropriate parameters. It also registers a cleanup function to properly destroy the process group at exit.
Parameters:
The backend to use for torch.distributed (e.g., ‘nccl’).
Timeout (in minutes) for distributed initialization. Defaults to 1.
Returns:
An instance containing the distributed environment configuration.