Skip to content

Rank-resolved setup timeline (statistical sampler) and its summary - #88

Merged
cekees merged 4 commits into
mainfrom
setup-timeline-scripts
Oct 23, 2026
Merged

cekees merged 4 commits into
mainfrom
setup-timeline-scripts

Conversation

@cekees

@cekees cekees commented Oct 23, 2026

Copy link
Copy Markdown
Owner

Tooling for the setup-and-assembly scoping (P0), kept out of #75/#77. Two scripts in `test/multilevel/`, not collected by pytest:

  • `setup_timeline_mpi.py KIND NN LEVELS OUTDIR [interval=] [solve]`: records, per rank, the wall time of `NumericalSolution` construction and a sampled profile of it (a thread looks at the main thread's stack every 5 ms and credits the time since the previous sample to every function on the stack, inclusive, and to the innermost, self), plus owned/local node and element counts per level. Statistical sampling because cProfile and tracemalloc inflate per-call costs a thousandfold on this code; samples are weighted by elapsed time because a native call that holds the GIL delays the sampler thread. `TIMELINE_TAG` names the output for independent serial jobs.
  • `summarize_timeline.py DIR...`: setup time over ranks per run, then the functions whose inclusive time grows most from the first run to the last.

What it found (ceds-model, one socket / 96 cores / 192 threads, hex Q1, ~8.3–9.3k fine nodes per rank): setup 3.06 s on 1 rank to 5.76 s on 64; the same single-rank problem run as 64 independent processes at once, with no MPI, already takes 4.62 s. So about 58% of the growth is the node (and 53% with batched callbacks, 1.26 -> 2.81 s against 2.08 s independent). The rest is the ghost layer (1.24 local nodes per owned), the collective PETSc vector/matrix constructors (0.2–1.2 s) and mesh generation. Written up in `CXX_REFACTOR_setup_and_assembly_SCOPING.md` section 3.3a.

🤖 Generated with Claude Code

cekees and others added 2 commits October 23, 2026 05:15
…cross rank counts

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…the MPI_INIT flake too

Open MPI 5 on the macOS Intel runner fails to start a launch now and then: either PMIx
cannot find a network interface ("ptl_tool: problems getting address", exit 213) or a rank's
MPI_Init cannot reach the others ("It looks like MPI_INIT failed ... PML add procs failed",
exit 14). #88's two Intel runs each lost one test to the second message, once in
test_pro_cli (two ranks) and once in test/multilevel (four ranks). The retry that caught
the first message lived in test/multilevel/conftest.py, so it covered neither.

The retry now lives in test/conftest.py, wraps every subprocess.run from any test, and
matches both messages; nothing has run when either appears, so relaunching is safe, and
any other failure is returned as it is. The multilevel conftest keeps only its rank-slot
gate, layered over the root retry so a relaunch holds the same slots.
test_mpi_launch_retry.py drives the retry with a fake launcher that fails a given number
of times with a given message (PROTEUS_TEST_MPI_RETRY_DELAY=0 makes it quick).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@cekees
cekees merged commit bf759c2 into main Oct 23, 2026
10 checks passed
@cekees
cekees deleted the setup-timeline-scripts branch October 23, 2026 18:37
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.

1 participant