mindspore.mint.distributed.P2POp

View Source On Gitee
class mindspore.mint.distributed.P2POp(op, tensor, peer, group=None, tag=0)[source]

Object for batch_isend_irecv input, to store information of "isend" and "irecv".

Note

tensor will be modified in-place by final result when op is "irecv".

Parameters
  • op (Union[str, function]) – Only string of "isend" and "irecv" are allowed. Or function of distributed.isend and distributed.irecv are allowed.

  • tensor (Tensor) – tensor for sending/receiving.

  • peer (int) – remote global rank for send/receive.

  • group (str, optional) – The communication group to work on. If None, which means "hccl_world_group" in Ascend. Default: None.

  • tag (int, optional) – currently not supported yet. Default: 0.

Returns

P2POp Object.

Raises
Supported Platforms:

Ascend

Examples

>>> import numpy as np
>>> import mindspore
>>> from mindspore.mint.distributed import P2POp, isend, irecv
>>> from mindspore import Tensor
>>> # Launch 2 processes.
>>> send_tensor = Tensor(1.)
>>> send_op = P2POp('isend', send_tensor, 1)
>>> send_op = P2POp(isend, send_tensor, 1)
>>> recv_tensor = Tensor(0.)
>>> recv_op = P2POp('irecv', recv_tensor, 0)
>>> recv_op = P2POp(irecv, recv_tensor, 0)