Skip to content

Document and review spherical benchmark output/restart paths (write_timestep vs write_checkpoint) #138

Description

@gthyagi

Summary

This issue documents the current UW3 mesh/field output methods used in the spherical benchmark workflow and requests feedback on a restart-oriented follow-up design.

The immediate motivation is large spherical benchmark postprocessing, where:

  • write_timestep() output works with read_timestep(...)
  • but that reload path is expensive because it reconstructs fields from saved arrays and coordinates using a KDTree-based path
  • exact restart-style reload needs PETSc restart metadata that is not written by write_timestep()

This issue is for documentation and design review only. No implementation is proposed until feedback is received.

@lmoresi could you please review the comparison below and comment on the proposed direction? I plan to wait for feedback before making implementation changes.

Current Method 1: mesh.write_timestep(...)

What it writes

Typical output:

  • one mesh HDF5 file
  • one HDF5 file per mesh variable
  • optional XDMF file
  • ParaView-compatible groups such as /vertex_fields

Typical file set:

  • output.mesh.00000.h5
  • output.mesh.Velocity.00000.h5
  • output.mesh.Pressure.00000.h5
  • output.mesh.00000.xdmf

Typical variable-file structure:

  • /fields/<name>
  • /fields/coordinates
  • /vertex_fields/...

How reload works

read_timestep(...) does not perform an exact PETSc restart.

Instead it:

  1. opens the variable HDF5 file with h5py
  2. reads the saved field values from /fields/<name>
  3. reads the saved coordinates from /fields/coordinates
  4. builds a KDTree on the saved coordinates
  5. reconstructs values on the current mesh variable by coordinate-based matching / interpolation

So this method works because the file contains field values and coordinates. It does not require PETSc section/order metadata.

Advantages

  • Produces the standard benchmark output files already used by the repo
  • Generates XDMF for ParaView / visualisation
  • Works with read_timestep(...)
  • Flexible when reloading onto a different mesh or ordering because the reload path is coordinate-based

Disadvantages

  • Reload is expensive because read_timestep(...) uses h5py plus KDTree reconstruction
  • At large MPI size this can become very memory-heavy
  • Does not write the PETSc subDM section/order metadata needed for exact FE vector restart
  • Direct PETSc vector load from the /fields/... datasets is not reliable for exact restart

Current Method 2: mesh.write_checkpoint(...)

What it writes

Typical output:

  • one mesh HDF5 file
  • one restart/checkpoint HDF5 file

Typical file set:

  • restart.mesh.0.h5
  • restart.checkpoint.00000.h5

The restart file includes PETSc restart metadata under paths like:

  • /topologies/uw_mesh/dms/uw_mesh/order
  • /topologies/uw_mesh/dms/uw_mesh/section/...
  • /topologies/uw_mesh/dms/Velocity/order
  • /topologies/uw_mesh/dms/Velocity/section/atlasDof
  • /topologies/uw_mesh/dms/Velocity/section/atlasOff
  • /topologies/uw_mesh/dms/Velocity/vecs/Velocity/Velocity
  • /topologies/uw_mesh/dms/Pressure/order
  • /topologies/uw_mesh/dms/Pressure/section/atlasDof
  • /topologies/uw_mesh/dms/Pressure/section/atlasOff
  • /topologies/uw_mesh/dms/Pressure/vecs/Pressure/Pressure

How reload should work

This is a restart-style path rather than a coordinate-based remap path.

Conceptually it should:

  1. rebuild the distributed mesh / subDM layout
  2. restore PETSc section/order metadata
  3. load the saved FE vector into the distributed PETSc global vector
  4. scatter to local FE storage

This is the metadata missing from write_timestep() for exact restart.

Advantages

  • Writes the PETSc DM / subDM restart metadata needed for exact restart
  • Stores vectors together with section/order information
  • Better aligned with exact restart / exact FE field reconstruction
  • Avoids relying on coordinate/KDTree reconstruction as the restart mechanism

Disadvantages

  • Does not create XDMF output
  • Current design places all checkpoint variables into one checkpoint file
  • At very large scale, one shared checkpoint file may become an I/O hotspot
  • The current restore path is less straightforward than the read_timestep(...) path

Practical Comparison

In the spherical benchmark workflow:

  • write_timestep() is useful for visualisation and coordinate-based field reconstruction
  • write_checkpoint() is the appropriate format for exact restart-style reload

So the two methods are related, but they serve different purposes:

  • write_timestep() = visualisation / remap-oriented output
  • write_checkpoint() = restart metadata / exact reload-oriented output

Request For Feedback

The next design step I am considering is to preserve the restart advantages of write_checkpoint() while avoiding a single large checkpoint file and keeping visualisation support available.

I am not starting implementation yet. I would like feedback first on whether that direction is reasonable, especially for large spherical runs on high MPI counts.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

documentationImprovements or additions to documentationenhancementNew feature or requesttype:architectureSystem architecture review

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions