/usr/lib/python2.7/dist-packages/pytools/mpi.py is in python-pytools 2015.1.6-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 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | from __future__ import absolute_import
def check_for_mpi_relaunch(argv):
if argv[1] != "--mpi-relaunch":
return
from pickle import loads
f, args, kwargs = loads(argv[2])
f(*args, **kwargs)
import sys
sys.exit()
def run_with_mpi_ranks(py_script, ranks, callable, args=(), kwargs=None):
if kwargs is None:
kwargs = {}
import sys
import os
newenv = os.environ.copy()
newenv["PYTOOLS_RUN_WITHIN_MPI"] = "1"
from pickle import dumps
callable_and_args = dumps((callable, args, kwargs))
from subprocess import check_call
check_call(["mpirun", "-np", str(ranks),
sys.executable, py_script, "--mpi-relaunch", callable_and_args],
env=newenv)
|