|
The Sparta Modeling Framework
|
Class to enable a modeler to register checkpointable objects in simulation. More...
#include <Checkpointable.hpp>
Public Member Functions | |
| Checkpointable (sparta::TreeNode *cp_node) | |
| Create a Checkpointable object used to allocate components for checkpointing. | |
| template<class CheckpointableT , typename... CpArgs> | |
| CheckpointableT & | allocateCheckpointable (CpArgs... cp_args) |
| Allocate a checkpointable type. | |
Class to enable a modeler to register checkpointable objects in simulation.
Sparta's checkpointing mechanism use sparta::ArchData backend (for memory, registers) to save/restore checkpoints, but some classes store their data in member variables and not ArchData backends.
This class provides a simple interface that allows a user to register those member variables with Sparta's checkpointing mechanism.
Inside the Checkpointable, for each object registed/allocated, a block of memory is created to completely contain that object (for memory copy) and a reference to that memory is returned. If the checkpointed object is not self-contained, behavior will be indeterministic on checkpoint restores.
To guarantee the save/restore of a checkpointed object, the checkpointed object's types must be serializabtle, meaning they must be trivial/fundamental and direct. For example, the checkpointable object must not be nor contain any pointers to untracked memory. However, the checkpointed object is not required to be trivially constructable.
Examples of checkpointable types:
This class will not ensure the checkpointable object falls within the bound of the above contraints. In other words, the modeler is responsible for making sure the checkpointable object is self-contained within singluar storage capacity.
Example usecase:
Definition at line 90 of file Checkpointable.hpp.
|
inline |
Create a Checkpointable object used to allocate components for checkpointing.
Definition at line 96 of file Checkpointable.hpp.
|
inline |
Allocate a checkpointable type.
| cp_args | Arguments to pass to the object during construction |
| CheckpointableT | The object type – must not be a pointer |
| CpArgs | The object construction args (if required) |
A trival, copyable type can be POD, a simple structure containing POD types, structures with embedded POD types, and array types of PODs.
Definition at line 110 of file Checkpointable.hpp.