Repository navigation
Conversation
…D 48) read_checkpoint maps a variable file's points through the mesh's topology SF, which maps from the file the mesh was loaded from. That holds for a mesh rebuilt from the checkpoint. The mesh that wrote the file was loaded from the gmsh cache, numbered differently from np 2 on, and a read into a second variable on it gave the wrong field, silently. load_from_h5_plex_vector had the mirror fault: right on the writing mesh, wrong on a rebuilt one. - _from_plexh5 tags its topology SF with the source file; the mesh keeps it (_sf_source_file). - _write_petsc_reload_file records each file a mesh writes, with its layout (_petsc_layout_token: chart, cell count and point-SF graph, which adding a variable or moving the mesh keeps). - read_checkpoint compares the file's saved point order with the source file's. On a mismatch, the mesh that wrote the file in its current layout (agreed over the ranks) reads it back directly (same_layout); any other mesh is refused, on every rank, naming read_timestep and the rebuilt mesh. - load_from_h5_plex_vector goes through read_checkpoint in parallel unless this mesh wrote the file in this layout. Underworld development team with AI support from Claude Code
…(UNFILED 49) A file written with create_xdmf=False holds no fields/ group. read_timestep's rank 0 read fields/<name> to find the field's representation and raised KeyError there, while the other ranks waited in the following bcast: a hang at np 2 and 3. What rank 0 finds is now shared first. A file with a PETSc reload payload for the field is read through read_checkpoint (whose point map is checked since the previous commit); one with neither raises the same error on every rank. Underworld development team with AI support from Claude Code
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes for two findings with no issue (UNFILED 48 and 49 in the dev hub's list), both found in the review of #1297. Review: H1, the session that reviews pull requests and runs the parallel tests on a 96-thread Linux workstation (single system image; Intel Xeon Gold 6240R, AVX-512; MPICH).
UNFILED 48:
read_checkpointsilently read the wrong fieldThe failure.
read_checkpoint(file, data_name="T")into a second variable on the mesh that wrote the file gave the wrong field from np 2 on, with no error. Results on a box (cellSize 1/12, a P2 field of size up to about 2):The reviewer saw it at np 3 (0.248 with an empty rank, 0.198 without) and not at np 2; on this build it is also wrong at np 2.
The cause.
mesh.sf, the topology SF from loading the mesh's own file.<name>.mesh.<index>.h5).mesh.sfmaps that file's numbering. From np 2 on the two differ:dms/uw_mesh/orderequals the gmsh cache'stopology/orderat np 1 and not at np 2 or 3;The mirror fault.
load_from_h5_plex_vectorloads the vector as stored. It was exact on the writing mesh and wrong on a mesh rebuilt from the checkpoint (max deviation 1.58 and 1.59 at np 2 and 3).The change.
_from_plexh5tags its topology SF with the file it was loaded from, and the mesh keeps it (_sf_source_file)._write_petsc_reload_filerecords each file a mesh writes, with its layout._petsc_layout_tokenis each rank's chart, cell count and point-SF graph. Adding a variable rebuilds the DM but keeps these, and so does moving the mesh.read_checkpointcompares the file's saved point order with the order in the mesh's source file. Rank 0 reads both, and the verdict is broadcast. On a mismatch:same_layout);RuntimeErroron every rank. The message namesread_timestep, the rebuilt mesh andsame_layout=True.load_from_h5_plex_vector, in parallel, goes throughread_checkpointunless this mesh wrote the file in this layout.read_timestepremaps by coordinates and was exact throughout.UNFILED 49:
read_timestephung on a payload-only fileA file written with
create_xdmf=False, petsc_reload=Trueholds nofields/group.read_timestep's rank 0 readfields/<name>alone, to learn the field's representation, and raisedKeyError. The other ranks waited in the followingbcast, so it hung at np 2 and 3.What rank 0 finds is now shared first:
read_checkpoint, which this PR makes safe, so the two are in one PR;Test
tests/parallel/test_1302_checkpoint_reads_get_the_right_field_parallel.py, 7 cases, all checked against the written field at the nodes (max deviation < 1e-12):read_checkpointon the writing meshread_checkpointon the mesh rebuilt from the checkpointread_checkpointon another mesh built the same wayload_from_h5_plex_vector, writing mesh / rebuilt meshread_timestepof a payload-only file, intoTand intoUThe branch passes all 7 at np 1, 2 and 3, and at np 3 with the last rank empty (a test-only shell partition). On development, 3 fail at np 2 and 3, and the payload cases hang.
Regression
All runs are on a Python overlay of this branch.
read_checkpoint,read_timestep,write_timestep,petsc_reload,load_from_h5_plex_vectororwrite_checkpoint: 198 passed, 1 skipped.Underworld development team with AI support from Claude Code