new_group

paddle.distributed. new_group ( ranks=None, backend=None, timeout=datetime.timedelta(seconds=1800), nccl_comm_init_option=0 ) [source]

Creates a new distributed communication group.

Parameters
  • ranks (list) – The global ranks of group members.

  • backend (str) – The backend used to create group, only nccl is supported now.

  • timeout (datetime.timedelta, optional) – The waiting timeout for store relevant options, default is 30 minutes.

Returns

The group instance.

Return type

Group

Examples

>>> 
>>> import paddle

>>> paddle.distributed.init_parallel_env()
>>> tindata = paddle.randn(shape=[2, 3])
>>> gp = paddle.distributed.new_group([2, 4, 6])
>>> paddle.distributed.all_reduce(tindata, group=gp, sync_op=False)