Sophie

Sophie

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

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

from mpi4py import MPI

MPI.size = MPI.WORLD_SIZE
MPI.rank = MPI.WORLD_RANK

if MPI.size != 12:
    raise Warning, 'run me with 12 procs !!!'
    raise SystemExit

dims = (2,3,2)
periods = (False,)*3
reord = False

comm = MPI.WORLD.Create_cart(dims,periods,reord)


print '[%d]' % MPI.rank, 'dim:   ', comm.Get_dim()
print '[%d]' % MPI.rank, 'topo:  ', comm.Get_topo()
print '[%d]' % MPI.rank, 'rank:  ', comm.Get_cart_rank(comm.Get_coords(MPI.rank))
print '[%d]' % MPI.rank, 'coords:', comm.Get_coords(MPI.rank)
print ''

import sys
sys.stdout.flush()