Skip to content

Instantly share code, notes, and snippets.

@surhudm
Last active June 13, 2019 12:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save surhudm/bb0feb7b8e7b7d64b4dcd5f08a69fc09 to your computer and use it in GitHub Desktop.
Save surhudm/bb0feb7b8e7b7d64b4dcd5f08a69fc09 to your computer and use it in GitHub Desktop.
A simple mpi python program

A simple mpi program which outputs the rank and size of the MPI pool.

Save the following program as say test.py.

#!/usr/bin/env python
from mpi4py import MPI
from subprocess import call

comm = MPI.COMM_WORLD

print comm.rank, comm.size

#cmd = "processCcd.py DATA --rerun processCcdOutputs --id visit=%d ccd=%d" % (visit, ccd)
cmd = "sleep 120"
call(cmd, shell=1)

Run the program using:

mpirun python test.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment