Mpi4py
- Description
- MPI for Python (mpi4py) provides bindings of the Message Passing Interface (MPI) standard for the Python programming language, allowing any Python program to exploit multiple processors.
- Documentation
- mpi4py homepage
- Access
- Please refer to our Python page.
- Usage
- You will need also to load the
openmpi/gcc
modulefile in order to use mpi4py properly. - Here is an example of a submission script for Python 2.7:
#$ -cwd #$ -l h_rt=01:00:00 #$ -pe ompi* 4 module purge module load gcc openmpi/gcc python/2.7.2 mpirun python helloworld.py
Here is the content of helloworld.py
:
#!/usr/bin/env python from mpi4py import MPI comm = MPI.COMM_WORLD print "Hello! I'm rank %d from %d running in total..." % (comm.rank, comm.size) comm.Barrier()