That page is really outdated (for mpi4py>=1.0)...
Take a look here:
http://mpi4py.scipy.org/docs/usrman/tutorial.html
--
Lisandro Dalcin
---------------
CIMEC (INTEC/CONICET-UNL)
Predio CONICET-Santa Fe
Colectora RN 168 Km 472, Paraje El Pozo
Tel: +54-342-4511594 (ext 1011)
Tel/Fax: +54-342-4511169
if rank==0:
m=[numpy.array(range(p*size),dtype=float) for p in size]
print(m)
sendbuf=m
A
> --
> You received this message because you are subscribed to the Google Groups "mpi4py" group.
> To post to this group, send email to mpi...@googlegroups.com.
> To unsubscribe from this group, send email to mpi4py+un...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/mpi4py?hl=en.
>
>
@Aron/@Konstantin: your suggestion is very valid, however take into
account that such approach will use pickle under the hood, then it is
not the most efficient way to communicate array data. The code below
is a far better, it should get near-C speed.
from mpi4py import MPI
import numpy as np
comm = MPI.COMM_WORLD
rank = comm.Get_rank()
size = comm.Get_size()
if rank==0:
# process 0 is the root, it has data to scatter
sendbuf = np.arange(size*size, dtype=float)
sendbuf.shape = (size, size) # actually not required
else:
# processes other than root do not send
sendbuf = None
# all processes receive data
recvbuf = np.arange(size, dtype=float)
print "[%d] sendbuf=%r" % (rank, sendbuf)
comm.Scatter(sendbuf, recvbuf, root=0)
print "[%d] recvbuf=%r" % (rank, recvbuf)
On 30 November 2010 10:25, Konstantin Kudryavtsev
> --
> You received this message because you are subscribed to the Google Groups "mpi4py" group.
> To post to this group, send email to mpi...@googlegroups.com.
> To unsubscribe from this group, send email to mpi4py+un...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/mpi4py?hl=en.
>
>
--