You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Found during the #330 batch (2026-07-23): fixing the Swarm.save race unmasked this in tests/test_0003_save_load.py at np4 — the file previously hung before reaching it.
Any mesh construction where a rank ends up with zero local cells crashes:
mpirun -np 4 python -c "import underworld3 as uw; uw.meshing.StructuredQuadBox(elementRes=(2,2))"
# rank with no cells:
# ValueError: Buffer has wrong number of dimensions (expected 2, got 1)
# at src/underworld3/ckdtree.pyx:99, via _build_kd_tree_index
# (discretisation_mesh.py:5154); other ranks then die on MPI_ERR_BUFFER
# from the resulting collective divergence.
Two layers to it:
_build_kd_tree_index builds numpy.array(control_points_list) / numpy.array(centroids_list) — empty lists give 1-D (0,) arrays, which the KDTree memoryview (double[:,::1]) rejects.
Shaping them (0, dim) is not enough on its own: KDTree.__cinit__ takes &points[0][0] (ckdtree.pyx:104), which is invalid for zero rows — the constructor needs an explicit empty-index path (related to the fix(swarm): Track-0 stale-cache and migration-semantics fixes (BF-02/05/06/07/08 + #286) #313 empty-rank KDTree query guards, which protected callers but not construction).
Verified identical on unmodified development (54a4fc58). Reproduces with any partition that starves a rank of cells — tiny meshes are just the easy trigger; extreme partition imbalance on real meshes would hit the same wall.
Also worth noting: tests/test_0003_save_load.py runs cleanly under MPI up to this point once #330 is fixed; this is the remaining blocker to making that file part of a parallel gate.
Underworld development team with AI support from Claude Code
Found during the #330 batch (2026-07-23): fixing the Swarm.save race unmasked this in
tests/test_0003_save_load.pyat np4 — the file previously hung before reaching it.Any mesh construction where a rank ends up with zero local cells crashes:
Two layers to it:
_build_kd_tree_indexbuildsnumpy.array(control_points_list)/numpy.array(centroids_list)— empty lists give 1-D(0,)arrays, which the KDTree memoryview (double[:,::1]) rejects.(0, dim)is not enough on its own:KDTree.__cinit__takes&points[0][0](ckdtree.pyx:104), which is invalid for zero rows — the constructor needs an explicit empty-index path (related to the fix(swarm): Track-0 stale-cache and migration-semantics fixes (BF-02/05/06/07/08 + #286) #313 empty-rank KDTree query guards, which protected callers but not construction).Verified identical on unmodified development (
54a4fc58). Reproduces with any partition that starves a rank of cells — tiny meshes are just the easy trigger; extreme partition imbalance on real meshes would hit the same wall.Also worth noting:
tests/test_0003_save_load.pyruns cleanly under MPI up to this point once #330 is fixed; this is the remaining blocker to making that file part of a parallel gate.Underworld development team with AI support from Claude Code