/usr/share/pyshared/pytools/mpi.py is in python-pytools 2013.5.7-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | def in_mpi_relaunch():
import os
return "PYTOOLS_RUN_WITHIN_MPI" in os.environ
def run_with_mpi_ranks(py_script, ranks, callable, *args, **kwargs):
if in_mpi_relaunch():
callable(*args, **kwargs)
else:
import sys, os
newenv = os.environ.copy()
newenv["PYTOOLS_RUN_WITHIN_MPI"] = "1"
from subprocess import check_call
check_call(["mpirun", "-np", str(ranks),
sys.executable, py_script], env=newenv)
|