mindspore/docs/api/api_python/mint/mindspore.mint.distributed....

30 lines
1.2 KiB
ReStructuredText
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

mindspore.mint.distributed.barrier
=====================================
.. py:function:: mindspore.mint.distributed.barrier(group=None, async_op=False, device_ids=None)
同步通信域内的多个进程。进程调用到该算子后进入阻塞状态,直到通信域内所有进程调用到该算子,
进程被唤醒并继续执行。
.. note::
当前仅支持PyNative模式不支持Graph模式。
参数:
- **group** (str可选) - 通信组名称,如果为 ``None`` Ascend平台表示为 ``"hccl_world_group"`` 。 默认值: ``None``
- **async_op** (bool, 可选) - 本算子是否是异步算子。默认值: ``False``
- **device_ids** (list[int], 可选) - 当前为预留参数。默认值: ``None``
返回:
CommHandle`async_op` 是TrueCommHandle是一个异步工作句柄。若 `async_op` 是FalseCommHandle将返回None。
异常:
- **TypeError** - `group` 不是str `async_op` 不是bool。
- **RuntimeError** - 如果后端无效,或者分布式初始化失败。
样例:
.. note::
.. include:: mindspore.mint.comm_note.rst
该样例需要在2卡环境下运行。