Skip to content

serial_reference: the spawned child keeps the user's MPI component selections (#922) - #930

Merged
lmoresi merged 4 commits into
developmentfrom
bugfix/serial-reference-keeps-mca-selection
Nov 3, 2026
Merged

lmoresi merged 4 commits into
developmentfrom
bugfix/serial-reference-keeps-mca-selection

Conversation

@lmoresi

@lmoresi lmoresi commented Nov 2, 2026

Copy link
Copy Markdown
Member

tests/parallel/serial_reference.py runs a test module's np 1 diagnostic in a spawned Python. It strips the launcher's variables from the child's environment, so that the child runs as a singleton and does not try to join the parent's job. It stripped every OMPI_* variable, and with them the user's own Open MPI component selections. On kaiju, jobs set OMPI_MCA_io=^ompio to keep HDF5 off OMPIO. Under load, every HDF5 error 76 (#922) was in a spawned reference run that never saw that setting.

Change

  • _child_env keeps the user's selections and their parameters (OMPI_MCA_<fw> and OMPI_MCA_<fw>_*) for:
    • io and its sub-frameworks (fcoll, fs, fbtl, sharedfp);
    • mtl, btl and pml;
    • opal_common_ucx.
  • It still drops the launcher's variables (OMPI_COMM_WORLD_*, PMIX_*, PMI_*, Slurm, Hydra and the rest).
  • A selection travels with its framework's parameters. With Open MPI 5, pml=cm without its OFI provider setting aborts the child's MPI_Init.
  • test_0855 and test_1079 spawn children of their own and now use the same _child_env.

Tests

tests/parallel/test_1138_serial_reference_child_env.py (tier B; serial batch 4 and CI's np 2 MPI phase) has two tests:

  • The scrub itself. Every user selection, including a parameter (OMPI_MCA_mtl_ofi_provider_include), is kept. No launcher variable is kept.
  • A spawned child that initialises MPI. It must come up with world size 1 and receive only kept settings. On development the child saw OMPI_MCA_io=None.

On kaiju (Open MPI 4.1.1, PETSc 3.25.0):

  • test_1138 passes serially and at np 2 and 4.
  • With these files in place, 24 low-load reruns of the earlier error-76 casualties had no error 76.
  • So did 24 runs launched at once on one node (12 × np 2 and 12 × np 4, each spawning its reference child). The children ran ROMIO. Before this change they ran OMPIO and failed with error 76 under less load than that. ROMIO in the children prevents it on these 12 test files; the full tests/parallel set was not rerun this way.
  • Pass and fail otherwise matched the low-load set.

Refs #922. The issue stays open: its library side is untouched. That side is _from_gmsh writing the mesh file through MPI-IO, which fails under OMPIO when many processes on a node do HDF5 I/O at once.

scripts/test.sh gains a line in serial batch 4 at the same place as the #919 PR and the patch summary PR.

Underworld development team with AI support from Claude Code

…selections

serial_reference spawns each test's np=1 diagnostic with every OMPI_*
variable scrubbed, which also drops OMPI_MCA_io=^ompio: on kaiju every HDF5
error 76 under load was in such a child (#922). test_1138 checks the scrub
(the user's io/mtl/btl/pml selections kept, the launcher's job-identity
variables dropped) and spawns a child through _run_child that reports what
it received. On development the child sees OMPI_MCA_io=None.

Underworld development team with AI support from Claude Code
…#922)

The scrub of the spawned np=1 child dropped every OMPI_* variable, the
user's MCA component selections with the launcher's job identity. A job
that set OMPI_MCA_io=^ompio to keep HDF5 off OMPIO had all its reference
runs on OMPIO anyway, and those runs carried every HDF5 error 76 on kaiju
under load. _child_env keeps OMPI_MCA_io, OMPI_MCA_mtl, OMPI_MCA_btl and
OMPI_MCA_pml, and drops everything else under the launcher prefixes;
test_1138 passes and is in serial batch 4.

Underworld development team with AI support from Claude Code
… scrub everywhere

From the adversarial review of ae9a45c:
- HIGH: keeping a framework's selection without its parameters can abort the
  child's MPI_Init where the parent's succeeds (measured on Open MPI 5.0.10:
  pml=cm with mtl=ofi and mtl_ofi_provider_include=tcp gives rc 1 under the
  narrow keep, rc 0 on development and in the parent). _child_env now keeps
  OMPI_MCA_<fw> and OMPI_MCA_<fw>_* for io and its sub-frameworks (fcoll,
  fs, fbtl, sharedfp), mtl, btl, pml and opal_common_ucx, and still drops
  every other launcher-prefixed variable; the docstring says what is still
  dropped (osc, coll, PMIX_MCA_*, PRTE_MCA_*, OMPI_CC).
- test_0855 and test_1079 spawned children with their own copy of the old
  scrub, so they still ran on OMPIO under a job's io=^ompio; both call
  _child_env now.
- test_1138's child initialises MPI and must be a singleton (size 1), and
  every launcher-prefixed variable it receives must be a kept framework
  setting, which under mpirun covers the launcher's real variables. The
  selections include a parameter (mtl_ofi_provider_include). Settings that
  are not launcher identity (OPAL_PREFIX, I_MPI_PIN, PRTE_MCA_*) are no
  longer listed as variables the scrub must drop.

Underworld development team with AI support from Claude Code
Copilot AI balanced review requested due to automatic review settings November 2, 2026 23:14
@lmoresi

lmoresi commented Nov 2, 2026

Copy link
Copy Markdown
Member Author

Pre-PR adversarial review

One round on ae9a45c. The HIGH and both MEDIUM findings were fixed in a79d523.

HIGH 1: the child kept a framework's selection but dropped its parameters, so its MPI_Init could abort where the parent ran. This was a regression against development.

  • Measured with Open MPI 5.0.10 and pml=cm, mtl=ofi, mtl_ofi_provider_include=tcp:
    • the full environment: rc 0, size 1;
    • the development scrub: rc 0 (falls back to ob1);
    • the branch: rc 1, "No components were able to be opened in the pml framework".
  • pml=ucx with pml_ucx_tls/pml_ucx_devices is the same mechanism (reasoned, not run).
  • Fixed: OMPI_MCA_<fw> and OMPI_MCA_<fw>_* are kept for io (and fcoll, fs, fbtl, sharedfp), mtl, btl, pml and opal_common_ucx. The test's selections include a parameter. Not widened to all of OMPI_MCA_*, because Open MPI 4.x mpirun injects component selections of its own.

MEDIUM 2: test_0855 and test_1079 spawn children with their own copy of the old scrub. Both write HDF5 under load. Fixed: both use _child_env.

MEDIUM 3: the test could not catch HIGH 1, and its mpirun claim had nothing behind it. Fixed: the child imports mpi4py.MPI and must report size 1, and every launcher-prefixed variable it receives must be a kept setting. On kaiju it passes serially and at np 2 and 4.

LOW 4: test 1 fails on development with an ImportError, not a behavioural assertion. Test 2 is the fail-first proof: on development the child sees OMPI_MCA_io=None.

LOW 5: the test's job-identity set listed settings that are not job identity (OPAL_PREFIX, I_MPI_PIN, PRTE_MCA_x). Fixed: the set is LAUNCHER_VARIABLES, without them.

LOW 6: the docs overstated what is kept. Fixed: _child_env's docstring names what is still dropped (osc, coll, PMIX_MCA_*, PRTE_MCA_*, OMPI_CC).

Attacks that failed

  • Open MPI 5.0.10 mpirun -n 1 env sets none of io, mtl, btl or pml, so what is kept is always the user's own choice.
  • A real singleton with io=^ompio, mtl=^ofi, btl=self,vader and pml=ob1 initialises with size 1, and io_base_verbose shows romio341 selected.
  • No hang mode: the failure mode is an MPI_Init abort, which _run_child reports.
  • CI reach: serial batch 4 and the np 2 MPI phase.

Issue verdicts

Underworld development team with AI support from Claude Code

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues remain for the changes preserving selected Open MPI settings in serial-reference child processes.

No open issues 🎉

What changed in this PR

This PR preserves selected Open MPI component settings in spawned serial-reference processes while continuing to remove launcher identity variables. It addresses the child-environment portion of #922; the library-side MPI-IO issue remains open.

Changes:

  • Adds a shared environment filter that retains supported component selections and their parameters.
  • Reuses the filter in mesh-smoothing and diffusion-restart subprocess tests.
  • Adds regression tests for environment filtering and singleton MPI initialization, and registers them in serial batch 4.
File Description
tests/​test_1079_diffusion_disk_restart.py Uses the shared environment filter for restart subprocesses.
tests/​parallel/​test_1138_serial_reference_child_env.py Tests retained settings, removed launcher variables, and singleton MPI initialization.
tests/​parallel/​test_0855_mesh_smoothing_parallel.py Uses the shared filter for the serial reference subprocess.
tests/​parallel/​serial_reference.py Preserves supported Open MPI settings when preparing child environments.
scripts/​test.sh Adds the new regression tests to serial batch 4.

Review effort: Balanced

…-selection

One conflict in scripts/test.sh, adjacent batch-4 lines (test_1133 from #928,
test_1138 from this branch); both kept.

Underworld development team with AI support from Claude Code
@lmoresi
lmoresi merged commit af6f19b into development Nov 3, 2026
13 of 15 checks passed
lmoresi pushed a commit that referenced this pull request Nov 3, 2026
One conflict in scripts/test.sh, adjacent batch-4 lines (test_1138 from #930,
test_1134 from this branch); both kept.

Underworld development team with AI support from Claude Code
lmoresi added a commit that referenced this pull request Nov 3, 2026
#930)

custom_mg: the split function's docstring keeps #921's text (no cover_max=None)
with #918's 2-D scope.

Underworld development team with AI support from Claude Code
lmoresi added a commit that referenced this pull request Nov 3, 2026
#930)

Underworld development team with AI support from Claude Code
lmoresi added a commit that referenced this pull request Nov 3, 2026
Shard 4 owns the whole --p N phase, and every new file under tests/parallel/
had also put its serial run in batch 4. It reached 55:32 on development
(run 41564997729, #930) and was cancelled at 60 minutes on this PR, during
test_1089 at np 2, which had not hung: development takes 48 s past the same
point. Shards 2 and 3 took about 29 minutes.

- The ten serial runs of tests/parallel files (test_1069 ... test_1139),
  about 6 minutes, go to shard 3.
- test_05*/06*/07*, about 4 minutes, go to shard 2.

--print-shards still gives [1,2,3,4], and check_test_coverage reports every
file reachable.

Underworld development team with AI support from Claude Code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants