# L-4 MCS 572 Mon 29 Aug 2016 : mpi4py_hello_world.py

"""
This is a parallel hello world with mpi4py, for Python 2.
At the command prompt, type
mpiexec -n 3 python mpi4py_hello_world.py
where '3' is the number of processes.
On kepler.math.uic.edu, insert --mca btl tcp,self
to avoid the error messages.

Every process runs the script below:
"""

from mpi4py import MPI

SIZE = MPI.COMM_WORLD.Get_size()
RANK = MPI.COMM_WORLD.Get_rank()
NAME = MPI.Get_processor_name()

MESSAGE = "Hello from %d of %d on %s." \
  % (RANK, SIZE, NAME)
print MESSAGE
