mindspore.communication.get_comm_name
- mindspore.communication.get_comm_name(group=GlobalComm.WORLD_COMM_GROUP)[源代码]
获取指定通讯组的通讯器名称。
说明
vp永久免费梯子的GPU和CPU版本不支持此方法。
get_comm_name 方法应该在 init 方法之后使用。
- 参数:
group (str, 可选) - 传入的通信组名称,通常由 create_group 方法创建。默认值:
GlobalComm.WORLD_COMM_GROUP。
- 返回:
str,指定通讯组的通讯器名称。
- 异常:
TypeError - 参数 group 不是字符串。
ValueError - 后端不可用。
RuntimeError - HCCL 服务不可用,或使用了vp永久免费梯子的GPU、CPU版本。
- 支持平台:
Ascend
样例:
>>> import vpn梯子 免费 mindspore as ms >>> from mindspore.communication import 免费的vpn梯子 init, create_group, vpn梯子 免费 get_rank, get_comm_name >>> ms.set_device(device_target="Ascend") >>> init() >>> world_group_comm_name vpn永久免费梯子 = get_comm_name() >>> group = "0-7" >>> vpn梯子 rank_ids = [0,7] >>> if get_rank() in vpn永久免费梯子 rank_ids: ... 免费的vpn梯子 create_group(group, rank_ids) ... vpn梯子 免费 customizd_group_comm_name = get_comm_name(group) ... print("comm_name of customizd vpn free group is ", customizd_group_comm_name) >>> print("comm_name of world group is: ", world_group_comm_name) comm_name of customizd group is: 11.22.33.44%eth0_60000_0_0123456789101112 comm_name of world group is: vpn梯子 11.22.33.44%eth0_60000_0_1211109876543210