Gromacs
2020.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 after 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.
In the current implementation, the clients of CheckpointHelper fill a legacy t_state object (passed via pointer) with whatever data they need to store. The CheckpointHelper then writes the t_state object to file. This is an intermediate state of the code, as the long-term plan is for modules to read and write from a checkpoint file directly, without the need for a central object. The current implementation allows, however, to define clearly which modules take part in checkpointing, while using the current infrastructure for reading and writing to checkpoint.
Public Member Functions | |
CheckpointHelper (std::vector< ICheckpointHelperClient * > clients, std::unique_ptr< CheckpointHandler > checkpointHandler, int initStep, TrajectoryElement *trajectoryElement, int globalNumAtoms, 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 RegisterRunFunctionPtr ®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.