mindspore.mint.distributed.destroy_process_group

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

Destroy the user collective communication group. If group is None or "hccl_world_group", Destroy all group and release collective communication lib.

Note

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

Parameters

group (str) – The communication group to destroy, the group should be created by init_process_group or new_group.

Raises
  • TypeError – If group is not a string.

  • RuntimeError – If HCCL is not available or MindSpore is GPU/CPU version.

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 import set_context
>>> from mindspore.mint.distributed import init_process_group, destroy_process_group
>>> set_context(device_target="Ascend")
>>> init_process_group()
>>> destroy_process_group()