Repository navigation
add_particles_with_coordinates: a point on a partition seam is added once - #1272
Conversation
On development at np 2, 11 interior seam vertices become 22 particles and 2 wall-and-seam vertices become 4; at np 3, 16 become 33 and 3 become 6, and the triangle with a rank without cells gives 24 for 20. Underworld development team with AI support from Claude Code
… to the lowest Mesh._points_owned_here compares only the claimed points in cells on a partition seam (from the point star forest): it gathers them, treats identical coordinates as one point, and gives each to the lowest rank claiming it. points_in_domain is unchanged and says its claim is not exclusive. Underworld development team with AI support from Claude Code
…ranks) Underworld development team with AI support from Claude Code
On the previous commit a rank given an empty array raised in the seam comparison before the gather, and the others waited (np 2, 3, 4). Underworld development team with AI support from Claude Code
…eaches the gather 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)) Review of #1272 at 04db0a8Verdict at 04db0a8: ready to merge on green from this review. The fix does what it says. A point on a partition seam is now added once, at np 2, 3 and 4, in 2-D and 3-D, on simplex and quad meshes, with empty ranks, a rank with no cells, pre-partitioned input and mixed input. Nothing hung. No point was lost. Off the seams, head and development add the same points. There is one cost finding (worst case only) and two small notes. None blocks the merge. Method
1. The new test file, head vs development
The pre-partitioned test passes on development too. That is expected, because nothing there changed. The new 2. The reproducer from the #1252 review (ten points on the walls of a unit simplex box, cell size 0.1)Counts are after
On development, "clamped" points end 1e-3 inside the wall, away from the seam. That is why they are not duplicated. With #1252 merged they land exactly on the wall, and #1252 alone gives 12 at np 2 band (from the #1252 review). With this PR merged too, they are added once. 3. Case matrix: expected / head / development (total particles)"Expected" is the set of distinct coordinates that some rank was given and also claims ( The point set is the seam vertices, seam edge midpoints (and seam face centroids in 3-D), vertices held by 3 or more ranks, up to 40 cell centroids per rank, 200 random points and about 30 wall vertices.
Also run in every config, all matching on head:
Development duplicates more than exact seam points. In 1e6 uniform random points at np 4, development added 46 extra particles in 2-D and 54 in 3-D. These are face-tolerance claims near a seam. Head added exactly 1e6. The same code path serves 4. Identical coordinates
So the rule is consistent between seam and non-seam points. Section 5, finding 2 has the one corner where it shows. 5. Findings
At np 4, the share of claimed uniform points that are gathered was 8.2% (2-D simplex, cell size 0.02), 8.7% (quad 50×50) and 35.4% (3-D simplex, cell size 0.08). That share grows with rank count. Every rank receives the seam-cell points of every other rank, not only of its neighbours. This is not a blocker for the fix. A follow-up could exchange only with the ranks that share the seam (the point star forest names them), or route each point to one rank by a hash of its coordinates.
Collective safety (read): Other details checked in the diff: identity is exact float equality of the raw input rows, which is right because every rank holds the same array. Cost in the common case (uniform points), median of three after a warm-up. Other jobs were running on the machine, so the spread between rounds is about ±30%.
At np 1 the new code returns before any extra work. The np 1 differences are noise. At np 4 the overhead in the common case is within the noise, up to about +25%. That fits the author's +5–6%, given this load. 6. Callers and other tests (head)
Run and not runRun: everything above. Not run:
Logs kept by the reviewer. Underworld development team with AI support from Claude Code |
What changed and why
UNFILED 20 from the parallel review desk's review of #1252. #1252 waits on this PR.
Swarm.add_particles_with_coordinatesis given the same coordinate array on every rank and keeps the pointsMesh.points_in_domainclaims for that rank. A point on a partition seam lies in the cells of every rank on that seam, so each of them claimed it and added it. On a unit box at np 2 the review desk's ten points became eleven, or twelve with a band partition. It happens for a seam point inside the mesh and where a seam meets a wall. On development, points clamped onto a wall sat 1e-3 inside it and escaped; #1252 snaps them exactly onto the wall, so there they would duplicate too.Now
add_particles_with_coordinatesasksMesh._points_owned_here, which gives each claimed point to the lowest rank that claims it:Mesh._seam_points, a leaf here or a root with leaves elsewhere), not from coordinates.points_in_domainis unchanged: it stays a per-rank claim, and a seam point stays claimed by every rank on the seam. Its docstring now says the claim is not exclusive and points to_points_owned_here. Its other callers see no change.What a user's run does now: at more than one rank,
add_particles_with_coordinatesadds each given point once. Before, a point on a seam was added once per rank on the seam, andmigrate()kept every copy.#1258 (
global_evaluate's ownership, not merged) applies the same lowest-rank rule to its evaluation swarm after migration, where the question is containment of points already distributed. The two share the rule, not code, so no shared helper is introduced.Test
tests/parallel/test_1260_add_particles_one_owner_per_point_parallel.py(level 1, tier B). The test points are the mesh's own seam vertices, found from the point star forest, plus cell centroids. The baseline is exact: every given point is in the swarm once, at the given coordinates.The pre-partitioned case passes on development; it was added after a first version of this fix raised on a rank given an empty array before the gather, which hung the others (found by the swarm files with a rank holding no points). With the fix, all five pass on every rank at np 2, 3 and 4.
scripts/test.shruns the file at np 3 always, because the triangle leaves a rank empty only from three ranks.The review desk's reproducer at np 2 and 3: 10 points give 10 after the add and 10 after
migrate()(points_in_domainstill claims the seam point on two ranks, as stated).Cost
_points_owned_hereagainstpoints_in_domainalone (the old path), uniform random points on a unit box of cell size 0.02, best of three, slowest rank:What was run
On a 96-thread Linux workstation (single system image, Intel Xeon Gold 6240R, MPICH):
add_particles_with_coordinatesorpoints_in_domain, with the collective guard scanscripts/check_test_coverage.py,scripts/check_deprecated_patterns.pyNot run
Above np 4; a band partition (the default partitions give both cases); 3-D meshes; meshes that are not straight-sided simplices (their interior claims carry no cell, so every claimed point there is compared, which is correct but untested); the full suite; macOS.
Underworld development team with AI support from Claude Code