mindspore.communication.comm_func.barrier
- mindspore.communication.comm_func.barrier(group=GlobalComm.WORLD_COMM_GROUP)[源代码]
mindspore.communication.comm_func.barrier 从2.9.0版本开始已被弃用,并将在未来版本中被移除。 建议使用
mindspore.ops.communication.barrier()替代。同步通信域内的多个进程。进程调用到该算子后进入阻塞状态,直到通信域内所有进程调用到该算子,进程被唤醒并继续执行。
- 参数:
group (str, 可选) - 工作的通信组。默认值:
GlobalComm.WORLD_COMM_GROUP(即Ascend平台为"hccl_world_group",GPU平台为"nccl_world_group")。
- 异常:
RuntimeError - 后端无效,或分布式初始化失败。
- 支持平台:
Deprecated
样例:
>>> import mindspore as ms >>> import mindspore.communication as comm >>> >>> # Launch 2 processes. >>> comm.init() >>> comm.comm_func.barrier() >>> print("barrier finish!") barrier finish!