def bcast(self, obj=None, root=None):
"""Same with the Broadcast but, it handles for unknown root among
the nodes.
"""
size = self.cart_comm.Get_size()
if size == 1:
return obj
if root is None:
obj = self.cart_comm.recv(source = MPI.ANY_SOURCE)
else:
for dest in xrange(size):
if dest != root:
self.cart_comm.send(obj, dest)
return obj
评论列表
文章目录