get_mesh

paddle.distributed. get_mesh ( ) [源代码]

获取用户通过 set_mesh 接口设定的全局 mesh。

返回

paddle.distributed.ProcessMesh:通过 set_mesh 接口设定的全局 mesh。

代码示例

>>> import paddle
>>> import paddle.distributed as dist
>>> mesh = dist.ProcessMesh([[[0, 1], [2, 3]], [[4, 5], [6, 7]]], dim_names=["dp", "mp", "pp"])
>>> dist.auto_parallel.set_mesh(mesh)
>>> mesh = dist.auto_parallel.get_mesh()
>>> # This case need to be executed in multi-card environment
>>> # python -m paddle.distributed.launch --gpus=0,1,2,3,4,5,6,7 {test_case}.py