Since MPI is run on every node, and since we're using Python, we can mix the two for some neat outcomes. The first one that we'll show is conditional statements, based on comm.rank.
from mpi4py import MPI comm = MPI.COMM_WORLD print "my rank is:",comm.rank if comm.rank == 1: print 'Doing the task of Rank 1' if comm.rank == 0: print 'Doing the task of Rank 0!'
Here, we show the beginnings of how you might have very node-specific tasks.
Saving this as sct.py:
mpirun.openmpi -np 2 -machinefile /home/pi/mpi_testing/machinefile python ~/Desktop/sct/sct3.py