Skip to content

Commit

Permalink
mpi.py: add comments (#853)
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiasdiener authored Mar 16, 2023
1 parent babc6d2 commit 35078c8
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion mirgecom/mpi.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 <args>').")

# 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.")
Expand All @@ -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

Expand Down

0 comments on commit 35078c8

Please sign in to comment.