def pprint(message=None, comm=None, root=0): if comm is None: comm = COMM_WORLD inbuf = comm.SERIALIZER.dump(message) result = _mpi.gather_string(inbuf, None, root, comm) if comm.Get_rank() == root: for i in result: msg = comm.SERIALIZER.load(i) print msg
def pprint(message = None, comm = None, root = 0): if comm is None: comm = COMM_WORLD inbuf = comm.SERIALIZER.dump(message) result = _mpi.gather_string(inbuf, None, root, comm) if comm.Get_rank() == root: for i in result: msg = comm.SERIALIZER.load(i) print msg
def Gather(self, sendbuf, recvbuf=None, root=0): sendbuf, sfastmode = _mpi.make_buf(sendbuf) recvbuf, rfastmode = _mpi.make_buf(recvbuf) if sfastmode or rfastmode: _mpi.gather(sendbuf, recvbuf, root, self) return else: serializer = self.SERIALIZER if _mpi.comm_test_inter(self): if root != _mpi.ROOT and root != _mpi.PROC_NULL: sendbuf = serializer.dump(sendbuf) else: sendbuf = None else: sendbuf = serializer.dump(sendbuf) recvbuf = _mpi.gather_string(sendbuf, recvbuf, root, self) if recvbuf is not None: recvbuf = map(serializer.load, recvbuf) return recvbuf
def Gather(self, sendbuf, recvbuf = None, root = 0): sendbuf, sfastmode = _mpi.make_buf(sendbuf) recvbuf, rfastmode = _mpi.make_buf(recvbuf) if sfastmode or rfastmode: _mpi.gather(sendbuf, recvbuf, root, self) return else: serializer = self.SERIALIZER if _mpi.comm_test_inter(self): if root != _mpi.ROOT and root != _mpi.PROC_NULL: sendbuf = serializer.dump(sendbuf) else: sendbuf = None else: sendbuf = serializer.dump(sendbuf) recvbuf = _mpi.gather_string(sendbuf, recvbuf, root, self) if recvbuf is not None: recvbuf = map(serializer.load, recvbuf) return recvbuf