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
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 ofdistributed.isend
anddistributed.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
ValueError – 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)