from mpi4py import MPI comm = MPI.COMM_WORLD rank=comm.rank size=comm.size print 'Rank:',rank print 'Node Count:',size print 9**(rank+3)
Similar code to before, just with the inclusion of comm.size.
We're also just showing the dynamic capabilities of each node by doing the 9**rank operation.
Saved as sct4.py
mpirun.openmpi -np 2 -machinefile /home/pi/mpi_testing/machinefile python ~/Desktop/sct/sct4.py