Getting network processor size with the size command



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
MPI with MPI4py and Python tutorial

The next tutorial:





  • Build a Supercomputer with Raspberry Pis
  • Intro
  • Supplies
  • Installing Operating System
  • Downloading and installing MPI
  • Testing Supercomputer
  • MPI with MPI4py Introduction
  • Installing mpi4py for use with Python and MPI
  • First basic MPI script with mpi4py
  • Using conditional, Python, statements alongside MPI commands example
  • Getting network processor size with the size command
  • Sending and Receiving data using send and recv commands with MPI
  • Dynamically sending messages to and from processors with MPI and mpi4py
  • Message and data tagging for send and recv MPI commands tutorial
  • MPI broadcasting tutorial with Python, mpi4py, and bcast
  • Scatter with MPI tutorial with mpi4py
  • Gather command with MPI, mpi4py, and Python