mindspore.communication.get_comm_name

View Source On AtomGit
mindspore.communication.get_comm_name(group=GlobalComm.WORLD_COMM_GROUP)[source]

Get the communicator name of the specified collective communication group.

Note

This method isn't supported in GPU and CPU versions of MindSpore. This method should be used after init().

Parameters:

group (str, optional) – The communication group to work on. Normally, the group should be created by create_group, otherwise, using the default group. Default: GlobalComm.WORLD_COMM_GROUP .

Returns:

string, the inner communicator name of the group.

Raises:
Supported Platforms:

Ascend

Examples

Note

Before running the following examples, you need to configure the communication environment variables.

For Ascend/GPU/CPU devices, it is recommended to use the msrun startup method without any third-party or configuration file dependencies. Please see the msrun startup for more details.

>>> import mindspore as ms
>>> from mindspore.communication import init, create_group, get_rank, get_comm_name
>>> ms.set_device(device_target="Ascend")
>>> init()
>>> world_group_comm_name = get_comm_name()
>>> group = "0-7"
>>> rank_ids = [0,7]
>>> if get_rank() in rank_ids:
...     create_group(group, rank_ids)
...     customizd_group_comm_name = get_comm_name(group)
...     print("comm_name of customizd 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: 11.22.33.44%eth0_60000_0_1211109876543210