Sophie

Sophie

distrib > Mandriva > 2008.1 > i586 > by-pkgid > 2fe96174012fea2d88f752857a5bea1d > files > 32

python-mpi4py-0.6.0-4mdv2008.1.i586.rpm

from mpi4py import MPI

pprint = MPI._pprint
MPI.size = MPI.WORLD_SIZE
MPI.rank = MPI.WORLD_RANK

# list of values in each process
data = [MPI.rank*100, MPI.rank**2]


# print input data
msg = "[%d] input:  %s" % (MPI.rank, data)
pprint(msg)


# allgather
data = MPI.WORLD.Allgather(data)


# print result data
msg = "[%d] result: %s" % (MPI.rank, data)
pprint(msg)