mindspore.mint.distributed.P2POp
- 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
The tensor will be modified in-place by final result when op is
"irecv".Only support PyNative mode, Graph mode is not currently supported.
- Parameters
op (Union[str, function]) – The operation type. Either the string
"isend"or"irecv", or the functionmindspore.mint.distributed.isend()ormindspore.mint.distributed.irecv().tensor (Tensor) – The tensor to send or receive.
peer (int) – The remote global rank to send to or receive from.
group (str, optional) – The communication group to work on. Default:
None, which means"hccl_world_group"in Ascend.tag (int, optional) – Currently not supported. Default:
0.
- Returns
P2POp Object.
- Raises
TypeError – when op is not string or function of
'isend'and'irecv'.TypeError – when tensor is not type of Tensor or peer is not int.
NotImplementedError – when tag is not 0.
- 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)