diff --git a/mirgecom/mpi.py b/mirgecom/mpi.py index 922d41836..cd5c100ab 100644 --- a/mirgecom/mpi.py +++ b/mirgecom/mpi.py @@ -166,10 +166,14 @@ def mpi_entry_point(func) -> Callable: """ @wraps(func) def wrapped_func(*args, **kwargs) -> None: + # We enforce this so that an exception raised on one rank terminates + # all ranks. if "mpi4py.run" not in sys.modules: raise RuntimeError("Must run MPI scripts via mpi4py (i.e., 'python -m " "mpi4py ').") + # We enforce this so that we can work around certain interoperability issues, + # including the hwloc/mprobe ones below. if "mpi4py.MPI" in sys.modules: raise RuntimeError("mpi4py.MPI imported before designated MPI entry " "point. Check for prior imports.") @@ -181,7 +185,8 @@ def wrapped_func(*args, **kwargs) -> None: cl.get_platforms() # Avoid https://github.com/illinois-ceesd/mirgecom/issues/132 on - # some MPI runtimes. + # some MPI runtimes. This must be set *before* the first import + # of mpi4py.MPI. import mpi4py mpi4py.rc.recv_mprobe = False