MPIEnvironment

class lightning.pytorch.plugins.environments.MPIEnvironment[source]

Bases: ClusterEnvironment

An environment for running on clusters with processes created through MPI.

Requires the installation of the mpi4py package. See also: https://github.com/mpi4py/mpi4py

static detect()[source]

Returns True if the mpi4py package is installed and MPI returns a world size greater than 1.

Return type:

bool

global_rank()[source]

The rank (index) of the currently running process across all nodes and devices.

Return type:

int

local_rank()[source]

The rank (index) of the currently running process inside of the current node.

Return type:

int

node_rank()[source]

The rank (index) of the node on which the current process runs.

Return type:

int

world_size()[source]

The number of processes across all devices and nodes.

Return type:

int

property creates_processes_externally: bool

Whether the environment creates the subprocesses or not.

property main_address: str

The main address through which all processes connect and communicate.

property main_port: int

An open and configured port in the main node through which all processes communicate.