mindspore.mint.distributed.get_backend

View Source On Gitee
mindspore.mint.distributed.get_backend(group=None)[source]

Get the backend of communication process groups.

Note

Only one communication backend is supported by MindSpore for each process. It should be one of hccl/nccl/mccl. Currently only support hccl and mccl.

Parameters

group (str, optional) – The communication group to work on. Normally, the group should be created by mindspore.mint.distributed.new_group(), If None, which means "hccl_world_group" in Ascend. Default: None.

Returns

string, the backend of the group.

Raises

TypeError – If the group is not a str.

Supported Platforms:

Ascend

Examples

Note

Before running the following examples, you need to configure the communication environment variables. For Ascend devices, it is recommended to use the msrun startup method without any third-party or configuration file dependencies. Please see the msrun start up for more details.

>>> import mindspore as ms
>>> from mindspore.mint.distributed import init_process_group, get_backend
>>> ms.set_device(device_target="Ascend")
>>> init_process_group()
>>> backend = get_backend()
>>> print("backend is: ", backend)
backend is: hccl