diff --git a/tests/parallel/serial_reference.py b/tests/parallel/serial_reference.py index ae147c3a2..90c366a1b 100644 --- a/tests/parallel/serial_reference.py +++ b/tests/parallel/serial_reference.py @@ -42,7 +42,13 @@ import underworld3 as uw # Launcher variables that would make a spawned singleton try to join the parent job. -_MPI_ENV_PREFIXES = ("OMPI_", "PMIX_", "PMI_", "MPI_", "HYDRA_", "I_MPI_", "SLURM_") +# Every implementation we run under is named here, because a list that covers only +# the one on your desk passes locally and fails on the other one: a copy of this +# naming just the Open MPI family passed under Open MPI and aborted the child's +# MPI_Init under MPICH, whose variables are PMI_* (#675). PRTE_/PRTERUN_/OPAL_ are +# Open MPI 5's runtime, which is a separate family again from OMPI_. +_MPI_ENV_PREFIXES = ("OMPI_", "PMIX_", "PMI_", "MPI_", "HYDRA_", "I_MPI_", "SLURM_", + "PRTE_", "PRTERUN_", "OPAL_") _CACHE = {} diff --git a/tests/parallel/test_0855_mesh_smoothing_parallel.py b/tests/parallel/test_0855_mesh_smoothing_parallel.py index 6f98f22c8..2f11ca5cf 100644 --- a/tests/parallel/test_0855_mesh_smoothing_parallel.py +++ b/tests/parallel/test_0855_mesh_smoothing_parallel.py @@ -36,6 +36,8 @@ import underworld3 as uw from underworld3.meshing import smooth_mesh_interior +from serial_reference import _MPI_ENV_PREFIXES + pytestmark = [pytest.mark.mpi(min_size=2), pytest.mark.timeout(120)] @@ -248,21 +250,21 @@ def test_parallel_matches_serial_bit_identical(): comm = MPI.COMM_WORLD rank = comm.rank - # 1. Compute the serial reference (rank 0 only) in a clean - # subprocess. We strip MPI/PMIX/PRTE env vars first so the - # subprocess's PETSc doesn't try to attach to this mpirun's - # MPI world (which would deadlock both processes). + # 1. Compute the serial reference (rank 0 only) in a clean subprocess. The + # launcher's variables are stripped first, or the child's MPI_Init tries to + # join THIS mpirun's job and aborts on a descriptor it does not own. + # + # The prefix list is shared with serial_reference rather than restated here: + # a local copy that named only the Open MPI family passed on Open MPI and + # failed under MPICH, whose variables are PMI_* (#675). One list, so a + # launcher that is missing from it is missing everywhere and gets noticed. ref_path = None if rank == 0: tmpdir = tempfile.mkdtemp(prefix="winslow_ref_") ref_path = os.path.join(tmpdir, "ref.npz") clean_env = { k: v for k, v in os.environ.items() - if not (k.startswith("OMPI_") - or k.startswith("PMIX_") - or k.startswith("PRTE_") - or k.startswith("PRTERUN_") - or k == "OPAL_PREFIX") + if not k.startswith(_MPI_ENV_PREFIXES) } proc = subprocess.run( [sys.executable, "-c",