Advertisement
calcpage

hello_mpi.py

Nov 26th, 2019
961
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.34 KB | None | 0 0
  1. #!/usr/bin/python
  2. #to execute: mpirun -np 4 python hello_mpi.py (does not require: #!/usr/bin/python)
  3. #or
  4. #chmod 755 hello_mpi.py
  5. #to execute: mpirun -np hello_mpi.py (requires: chmod & #!/usr/bin/python)
  6. from mpi4py import MPI
  7. comm=MPI.COMM_WORLD
  8. rank=comm.Get_rank()
  9. size=comm.Get_size()
  10. print 'rank = ' + str(rank) + ' of ' + str(size) + '!'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement