To checkout pypar anonymously (read only)
svn checkout http://pypar.googlecode.com/svn pypar
To checkout pypar as a Google Code user
svn checkout https://pypar.googlecode.com/svn pypar --username
If you wish to participate in the development or just become part of the community, email Ole.Moller.Nielsen@gmail.com or subscribe to the mailing list at http://groups.google.com/group/pypar-discuss?pli=1
You can still browse the old repository at Sourceforge
You can also download the last (ANU) version of pypar here: pypar_1.9.3.tgz
Back to Ole Nielsen's Home Page
Pypar is an efficient but easy-to-use module that allows programs/scripts written in the Python programming language to run in parallel on multiple processors and communicate using message passing. Pypar provides bindings to an important subset of the message passing interface standard MPI. Other Python MPI bindings available from other developers include: PyMPI, Scientific Python and pythonMPI.
Pypar is characterised by the following features
pypar.send(x, destination=1) | # Send object x to processor 1 | |
y=pypar.receive(source=1) | # Receive object y from processor 1 |
You can also try out the
written for the our Summerschool in computational mathematics. The text mentions files to be copied from a particular directory - those files are now the pypar distribution. Two other related tutorials from the summerschool are available hereYou can download the source, tests documentation and examples for Pypar at http://datamining.anu.edu.au/software/pypar/pypar_1.9.3.tgz
Here is an example of a simple program using Pypar ring_example.py.
It basically communicates some text in a ring structure.
To run it on four MPI processes, say, simply issue the command:
mpirun -np 4 python ring_example.py
and thanks to Constantinos Makassikis for helping me render this code nicely in html with code2blog. Thanks heaps!
import pypar # The Python-MPI interface numproc = pypar.size() # Number of processes as specified by mpirun myid = pypar.rank() # Id of of this process (myid in [0, numproc-1]) node = pypar.get_processor_name() # Host name on which current process is running print 'I am proc %d of %d on node %s' %(myid, numproc, node) if myid == 0: # Actions for process 0 msg = 'P0' pypar.send(msg, destination=1) # Send message to proces 1 (right hand neighbour) msg = pypar.receive(source=numproc-1) # Receive message from last process print 'Processor 0 received message "%s" from processor %d' %(msg, numproc-1) else: # Actions for all other processes source = myid-1 destination = (myid+1)%numproc msg = pypar.receive(source) msg = msg + 'P' + str(myid) # Update message pypar.send(msg, destination) pypar.finalize()