ProcessMesh

class paddle.distributed. ProcessMesh ( mesh: npt.NDArray[Any] | NestedNumericSequence | None = None, dim_names: list[str] | None = None, shape: _NumpyShapeLike | None = None, process_ids: Iterable[Any] | None = None ) [source]

The ProcessMesh object describes the Cartesian topology of the used processes.

Parameters
  • mesh (list|numpy.array) – an n-dimensional array describes the topology of the processes.

  • dim_names (list, optional) – the i-th element of this list gives the name of the i-th dimension of the mesh.

Examples

>>> import paddle
>>> import paddle.distributed as dist

>>> mesh = dist.ProcessMesh([[2, 4, 5], [0, 1, 3]], dim_names=["x", "y"])
>>> assert mesh.shape == [2, 3]
>>> assert mesh.process_ids == [2, 4, 5, 0, 1, 3]
property mesh : npt.NDArray[Any]

Get the underlying mesh of ProcessMesh.

property dim_names : list[str]

Get the underlying dimension names of ProcessMesh.

property unique_id : int

Get the unique id of ProcessMesh. NOTE Unique id only take process_ids and shape into account. Different ProcessMesh with same process_ids and shape have same unique id.

contains ( self: paddle.base.libpaddle.ProcessMesh, arg0: int ) bool

contains

dim_size ( *args, **kwargs )

dim_size

Overloaded function.

  1. dim_size(self: paddle.base.libpaddle.ProcessMesh, arg0: int) -> int

  2. dim_size(self: paddle.base.libpaddle.ProcessMesh, arg0: str) -> int

empty ( self: paddle.base.libpaddle.ProcessMesh ) bool

empty