Repository navigation
Parallel plotting helpers: every rank joins global_evaluate, and a MeshVariable is accepted - #1243
Conversation
Every helper with a MeshVariable and with sympy expressions, viz_rank 0 and the last rank, against the exact linear field. On development the sympy cases hang (the plotting rank waits in global_evaluate) and the MeshVariable cases raise AttributeError on every rank. Runs at np 3 as well as np 2. Underworld development team with AI support from Claude Code
…shVariable is accepted The non-plotting ranks built their empty point array from field.mesh.dim, which a sympy expression does not have, so they raised before the collective the plotting rank was waiting in. The empty array now takes its dimension from the sample points, and a MeshVariable is evaluated through its .sym, in all four helpers. Underworld development team with AI support from Claude Code
|
Review from the Underworld development team with AI support from Claude Code (H1: review and parallel test runs on a 96-thread Linux workstation (Intel Xeon Gold 6240R, AVX-512; MPICH)) Verdict at 5e5d599: ready to merge on green from this review. The hang is fixed in all four helpers, and the values match serial exactly. I have one low finding. What I ran
Finding
BuildThe change is Python-only. The merge base 2a41d49 has the same compiled sources as an existing build at 8d8533d. I overlaid the head's Python, or the merge base's for the development runs, on that build. Every run used at most 3 ranks, on cores 80 to 83; cores 0 to 3 were in use by other work. Logs kept by the reviewer. Underworld development team with AI support from Claude Code |
What changed and why
The four plotting helpers in
src/underworld3/visualisation/parallel.py(parallel_line_plot,parallel_scatter_plot,parallel_profile_comparison,parallel_custom_plot) evaluate on the plotting rank (viz_rank) and have every other rank join the sameglobal_evaluatewith no points. They could not work at more than one rank. The parallel review desk found this while checking #1236 (its review there, finding 1); the bug predates that PR.np.array([]).reshape(0, field.mesh.dim). A sympy expression (T.sym,T.sym[0],2*T.sym[0]) has no.mesh, so those ranks raisedAttributeErrorand never reachedglobal_evaluate, while the plotting rank waited inside it.global_evaluatedoes not accept a MeshVariable.Now, in all four helpers:
np.zeros((0, np.asarray(sample_points).shape[1])), so every rank reaches the collective whatever the field is;.sym, so a user can pass either.Both are two small private helpers (
_no_points,_evaluable) used by all four functions. No signature changes; the docstrings now say a field may be a MeshVariable or a sympy expression.What a user's run does now: a notebook or script calling these helpers under
mpirunplots onviz_rankand returns on the others, where before it hung (sympy expression) or raised (MeshVariable). Serial runs are unchanged, apart from now accepting a MeshVariable.Test
tests/parallel/test_1243_parallel_plot_helpers_parallel.py(level 1, tier B; 12 cases): each helper,viz_rank0 and the last rank, with a MeshVariable and with sympy expressions (T.sym,T.sym[0], multiples of it). The baseline is exact:Tis a degree-1 variable holdingx + 2y, so the plotting rank's values at the sample points must equalx + 2y(or its multiple) to 1e-12; the other ranks must evaluate an empty (0, 2) array.scripts/test.shruns the file at np 3 as well as in the np 2 pass, since at three ranks two ranks join with no points.On development (unfixed source, same build), at np 2 and np 3, run case by case under the MPI supervisor:
parallel_line_plotwithT.sym,parallel_profile_comparisonwithT.sym[0]first) hang: the plotting rank waits inglobal_evaluateand the job is killed by the timeout;AttributeErroron every rank.What was run
On a 96-thread Linux workstation (single system image, Intel Xeon Gold 6240R, MPICH):
test_0846(both files),test_1057_native_vis_higher_order,test_0052_collective_guard_scan, serialscripts/check_test_coverage.pyscripts/check_deprecated_patterns.pyNot run
np 4 and above; a real display (the test uses matplotlib's Agg backend, so
plt.show()draws nothing); macOS; the full suite.Reviewer: the parallel review desk (H1).
Checklist (UW3 Style Charter — docs/developer/UW3_STYLE_CHARTER.md)
level_*andtier_*markers (S8)maybe_/try_/do_) and no commented-out code (S3, S4).array/mesh.X.coords— nowith ....access(...), nomesh.data(S7) — not applicable in the library change; the test writesT.arraypixi.toml/pixi.lockor other dependency changes riding in an unrelated PRUnderworld development team with AI support from Claude Code