latest (dev)
Copy
Latest development documentation · Updated 2026-10-08
tensorplay.distributed.device_mesh API
Functions 1
init_device_mesh
functionFull reference ↗- tensorplay.distributed.device_mesh.init_device_mesh(device_type: str, mesh_shape: tuple[int, ...], *, mesh_dim_names: tuple[str, ...] | None = None, backend_override=None) DeviceMesh[source]
This creates a DeviceMesh with an n-dimensional array layout, where n is the length of mesh_shape. If mesh_dim_names is provided, each dimension is labeled as mesh_dim_names[i].
Note
Follows SPMD: ensure mesh_shape is identical across all ranks.
Example:
>>> mesh_1d = init_device_mesh("cuda", mesh_shape=(8,)) >>> mesh_2d = init_device_mesh("cuda", mesh_shape=(2, 8), ... mesh_dim_names=("dp", "tp"))
Classes 1
DeviceMesh
classFull reference ↗- class tensorplay.distributed.device_mesh.DeviceMesh(device_type: str, mesh=None, *, mesh_dim_names=None, _dim_group_names=None, _rank_map=None, _sizes=None, _strides=None, _root_mesh=None, _backend_override=None, _axis_root_dims=None)[source]
The mesh is an n-d array whose values are global ranks. Process groups are created per mesh dimension so collectives can run on each dimension independently.
Example:
>>> from tensorplay.distributed.device_mesh import init_device_mesh >>> mesh = init_device_mesh("cuda", mesh_shape=(2, 4), ... mesh_dim_names=("dp", "tp"))- classmethod from_group(group, device_type=None, mesh=None, mesh_dim_names=None) DeviceMesh[source]
Construct a DeviceMesh from one or more existing process groups.
Help improve this page
Found an error, an unclear step, or a missing example?
tensorplay.distributed.checkpoint API
Complete API reference for tensorplay.distributed.checkpoint, including signatures, parameters, examples and members.
tensorplay.distributed.elastic.agent.server API
Complete API reference for tensorplay.distributed.elastic.agent.server, including signatures, parameters, examples and members.

