def recv(self, obj=None, tag=MPI.ANY_TAG, source=None, buffer=False, status=None, comm=None):
"""Wrapper around MPI.recv/Recv. Returns the received object.
Params:
obj: variable into which the received object should be placed
tag: string indicating which MPI tag should be received
source: integer rank of the message source. Defaults to self.parent_rank
buffer: True if the received object should be sent as a single-segment buffer
(e.g. for numpy arrays) using MPI.Recv rather than MPI.recv
status: MPI status object that is filled with received status information
comm: MPI communicator to use. Defaults to self.parent_comm"""
if comm is None:
comm = self.parent_comm
if source is None:
if self.parent_rank is None:
raise Error("Attempting to receive %s from parent, but parent rank is None" % tag)
source = self.parent_rank
tag_num = self.lookup_mpi_tag(tag)
if buffer:
comm.Recv( obj, source=source, tag=tag_num, status=status )
return obj
else:
obj = comm.recv( source=source, tag=tag_num, status=status )
return obj
评论列表
文章目录