Gromacs
2022.2
|
#include <gromacs/modularsimulator/checkpointhelper.h>
Checkpoint helper.
The CheckpointHelper
is responsible to write checkpoints. In the longer term, it will also be responsible to read checkpoints, but this is not yet implemented.
Writing checkpoints is done just before neighbor-searching (NS) steps, or after the last step. Checkpointing occurs periodically (by default, every 15 minutes), and needs two NS steps to take effect - on the first NS step, the checkpoint helper on master rank signals to all other ranks that checkpointing is about to occur. At the next NS step, the checkpoint is written. On the last step, checkpointing happens immediately before the step (no signalling). To be able to react to last step being signalled, the CheckpointHelper does also implement the ISimulatorElement
interface, but does only register a function if the last step has been called. It should be placed on top of the simulator loop.
Checkpointing happens at the end of a simulation step, which gives a straightforward re-entry point at the top of the simulator loop.
Checkpoint writing is done by passing sub-objects of a WriteCheckpointDataHolder object to the clients. Checkpoint reading is done by passing sub-objects of a ReadCheckpointDataHolder object (passed in from runner level) do the clients.
Public Member Functions | |
CheckpointHelper (std::vector< std::tuple< std::string, ICheckpointHelperClient * >> &&clients, std::unique_ptr< CheckpointHandler > checkpointHandler, int initStep, TrajectoryElement *trajectoryElement, FILE *fplog, t_commrec *cr, ObservablesHistory *observablesHistory, gmx_walltime_accounting *walltime_accounting, t_state *state_global, bool writeFinalCheckpoint) | |
Constructor. | |
void | run (Step step, Time time) |
Run checkpointing. More... | |
void | scheduleTask (Step step, Time time, const RegisterRunFunction ®isterRunFunction) override |
Register run function for step / time. More... | |
void | elementSetup () override |
No element setup needed. | |
void | elementTeardown () override |
No element teardown needed. | |
Public Member Functions inherited from gmx::ILastStepSignallerClient | |
virtual | ~ILastStepSignallerClient ()=default |
Standard virtual destructor. | |
Public Member Functions inherited from gmx::ISimulatorElement | |
virtual | ~ISimulatorElement ()=default |
Standard virtual destructor. | |
Additional Inherited Members |
Run checkpointing.
Sets signal and / or performs checkpointing at neighbor searching steps
step | The step number |
time | The time |
|
overridevirtual |
Register run function for step / time.
Performs checkpointing at the last step. This is part of the element call list, as the checkpoint helper need to be able to react to the last step being signalled.
step | The step number |
time | The time |
registerRunFunction | Function allowing to register a run function |
Implements gmx::ISimulatorElement.