r"""Send tensor to another process. Args: inp: Tensor to send. dest_rank: Rank of destination process. Returns: None. Examples: .. code-block:: if rank == 0: data = mge.tensor(1) # Tensor(1) F.dis
(inp: Tensor, dest_rank: int)
| 820 | |
| 821 | |
| 822 | def remote_send(inp: Tensor, dest_rank: int): |
| 823 | r"""Send tensor to another process. |
| 824 | |
| 825 | Args: |
| 826 | inp: Tensor to send. |
| 827 | dest_rank: Rank of destination process. |
| 828 | |
| 829 | Returns: |
| 830 | None. |
| 831 | |
| 832 | Examples: |
| 833 | .. code-block:: |
| 834 | |
| 835 | if rank == 0: |
| 836 | data = mge.tensor(1) |
| 837 | # Tensor(1) |
| 838 | F.distributed.remote_send(data, 1) # return None |
| 839 | else: |
| 840 | data = F.distributed.remote_recv(0) |
| 841 | # Tensor(1) |
| 842 | """ |
| 843 | group = _SendRecvGroup(get_rank(), dest_rank) |
| 844 | _bcast_shape_dtype(group, inp) |
| 845 | _bcast_tracer_state(group, inp) |
| 846 | op = RemoteSend() |
| 847 | op.key = group.key |
| 848 | op.addr, op.port = get_mm_server_addr() |
| 849 | op.rank_to = dest_rank |
| 850 | op.backend = _backend() |
| 851 | out = _RemoteSend(op)(inp) |
| 852 | _save_output_for_autodiff(inp, out) |
| 853 | |
| 854 | |
| 855 | def remote_recv(src_rank: int, device: Optional[str] = None, inp=None) -> Tensor: |