mindspore.mint.distributed.new_group
- mindspore.mint.distributed.new_group(ranks=None, timeout=None, backend=None, pg_options=None, use_local_synchronization=False, group_desc=None)[source]
Create a new distributed group.
Note
This method should be used after
mindspore.mint.distributed.init_process_group()
.- Parameters
ranks (list[int], optional) – List of ranks of group members. If
None
, will be create the world group. Default isNone
.timeout (int, invalid) – Currently it is a reserved parameter.
backend (str, invalid) – Support backend Library, Currently support
"hccl"
and"mccl"
. when backend is"hccl"
will use Huawei Collective Communication Library(HCCL). when backend is"mccl"
will use MindSpore Collective Communication Library(MCCL). IfNone
, which means"hccl"
in Ascend. Default isNone
.pg_options (GroupOptions, optional) –
Additional communication group configuration parameters. The backend will automatically select supported parameters and apply them during group initialization. i.e. for the
HCCL
backend,hccl_config
can be specified so that group initialization configurations can be applied. Default isNone
.GroupOptions is defined as a class that can be instantiated as a python object.
GroupOptions { hccl_config(dict) }
use_local_synchronization (bool, invalid) – Currently it is a reserved parameter.
group_desc (str, invalid) – Currently it is a reserved parameter.
- Returns
A string with group name. Return "" in the abnormal scenarios.
- Raises
TypeError – If list ranks in Group has duplicate rank id.
- 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, new_group >>> ms.set_device(device_target="Ascend") >>> init_process_group() >>> group = new_group() >>> print("group is: ", group) group is: hccl_world_group