| FEAT 3
    Finite Element Analysis Toolbox | 
Checkpoint/Restart infrastructure. More...
#include <checkpoint_control.hpp>
| Public Member Functions | |
| CheckpointControl (const Dist::Comm &comm, const LAFEM::SerialConfig &config=LAFEM::SerialConfig()) | |
| Constructor.  More... | |
| ~CheckpointControl () | |
| Destructor.  More... | |
| template<typename OT_ > | |
| void | add_object (String identifier, OT_ &object) | 
| Register checkpointable object.  More... | |
| void | clear_input () | 
| Delete all read input.  More... | |
| String | get_identifier_list () | 
| Retrieve a list of all items stored in the checkpoint.  More... | |
| void | load (BinaryStream &bs) | 
| Load checkpoint from stream.  More... | |
| void | load (const String filename) | 
| Load checkpoint from disk.  More... | |
| void | remove_object (String identifier) | 
| Remove checkpointable object.  More... | |
| template<typename OT_ > | |
| void | restore_object (String identifier, OT_ &object, bool add_to_checkpoint_control=true) | 
| Restore checkpointable object.  More... | |
| void | save (BinaryStream &bs) | 
| Save checkpoint to a stream.  More... | |
| void | save (const String filename) | 
| Write checkpoint file to disk.  More... | |
| void | set_config (FEAT::LAFEM::SerialConfig &conf) | 
| Set a new serialize configuration.  More... | |
| Private Member Functions | |
| std::uint64_t | _collect_checkpoint_data (std::vector< char > &buffer) | 
| Build checkpoint buffer.  More... | |
| void | _load (const String name) | 
| Load checkpoint from disk.  More... | |
| void | _restore_checkpoint_data () | 
| Extract input buffer.  More... | |
| void | _save (const String name) | 
| Write checkpoint files to disk.  More... | |
| Private Attributes | |
| std::map< String, std::shared_ptr< Checkpointable > > | _checkpointable_by_identifier | 
| Mapping of identifier string to pointer to the checkpointable object.  More... | |
| const Dist::Comm & | _comm | 
| the mpi communicator identifying our mpi context  More... | |
| FEAT::LAFEM::SerialConfig | _config | 
| The config class that controls the compression modes.  More... | |
| std::vector< char > | _input_array | 
| Vector holding the array read from the input file during restore.  More... | |
| std::map< String, std::uint64_t > | _offset_by_identifier | 
| Mapping of identifier string to the offset in the input file.  More... | |
Checkpoint/Restart infrastructure.
This class provides a general interface for checkpoint/restart usecases. Compatible objects can be summed up to a single checkpoint. This checkpoint can then be stored and restored via mpi io mechanics. Afterwards, any object can be restored from the recreated checkpoint.
Definition at line 140 of file checkpoint_control.hpp.
| 
 | inline | 
Constructor.
Initalize the input array as NULL pointer.
| [in] | comm | The communicator common to all stored objects | 
| [in] | config | A config class, controlling the compression of the written out data | 
Definition at line 280 of file checkpoint_control.hpp.
References _input_array.
| 
 | inline | 
Destructor.
Destroy the checkpoint control instance and delete the input array.
Definition at line 292 of file checkpoint_control.hpp.
| 
 | inlineprivate | 
Build checkpoint buffer.
Collect all data needed for a checkpoint from every object registered at the checkpoint control.
| [in] | buffer | buffer containing the collected data | 
Definition at line 163 of file checkpoint_control.hpp.
References _checkpointable_by_identifier, and _config.
| 
 | inlineprivate | 
Load checkpoint from disk.
Read binary file [name].cp holding a safed state of all checkpointable objects and store it to _input_array.
Fill the _offset_by_identifier map with the data from the array.
| [in] | name | String holding the name of the file (without the extension .zcp) | 
Definition at line 260 of file checkpoint_control.hpp.
References _comm, _input_array, _restore_checkpoint_data(), and FEAT::DistFileIO::read_combined().
Referenced by load().
| 
 | inlineprivate | 
Extract input buffer.
Extract the identifier string and offset for its data in the input array for every object in the read checkpoint, and store this information for restoration in this checkpoint control object.
Definition at line 208 of file checkpoint_control.hpp.
References _input_array, and _offset_by_identifier.
| 
 | inlineprivate | 
Write checkpoint files to disk.
Write one binary file: [name].cp: a uncompressed binary file holding the current status of all checkpointable objects added to the checkpoint control
| [in] | name | String holding the name of the file (without the extension .cp) | 
Definition at line 240 of file checkpoint_control.hpp.
References _collect_checkpoint_data(), _comm, and FEAT::DistFileIO::write_combined().
Referenced by save().
| 
 | inline | 
Register checkpointable object.
Adds a pointer to a checkpointable object to the checkpoint control.
The object will be internally identified by its indentifier string (especially during restoration).
| [in] | identifier | String used as identifier | 
| [in] | object | Pointer to the checkpointable object | 
Definition at line 346 of file checkpoint_control.hpp.
References _checkpointable_by_identifier, and XASSERTM.
Referenced by restore_object().
| 
 | inline | 
Delete all read input.
Clear the input read before from this checkpoint control object. Does not touch the map holding the pointers to the checkpointable objects included into the following written checkpoints.
Definition at line 313 of file checkpoint_control.hpp.
References _input_array, and _offset_by_identifier.
| 
 | inline | 
Retrieve a list of all items stored in the checkpoint.
Definition at line 320 of file checkpoint_control.hpp.
References _checkpointable_by_identifier.
| 
 | inline | 
Load checkpoint from stream.
Read the BinaryStream, to restore the safed state of all objects registered to the checkpoint control and store it to _input_array.
Fill the _offset_by_identifier map with the data from the array.
| [in] | bs | BinaryStream that shall be read from | 
Definition at line 488 of file checkpoint_control.hpp.
References _input_array, _restore_checkpoint_data(), FEAT::BinaryStream::data(), and XASSERTM.
| 
 | inline | 
Load checkpoint from disk.
Read the [filename.cp] file, to restore the size of the checkpoint data per rank.
Read binary file [filename] holding a safed state of all checkpointable objects and store it to _input_array.
Fill the _offset_by_identifier map with the data from the array.
| [in] | filename | String holding the name of the file | 
Definition at line 440 of file checkpoint_control.hpp.
References _input_array, _load(), XABORTM, and XASSERTM.
| 
 | inline | 
Remove checkpointable object.
Remove pointer to a checkpointable object from the checkpoint control.
| [in] | identifier | Identifier of the object to remove | 
Definition at line 361 of file checkpoint_control.hpp.
References _checkpointable_by_identifier, and XASSERTM.
| 
 | inline | 
Restore checkpointable object.
Restore a checkpointable object from the checkpoint control. The objects contents will be found by its identifier string and restored.
| [in] | identifier | Identifier of the object to restore | 
| [out] | object | Reference to object | 
| [in] | add_to_checkpoint_control | If true the restored object is added to the checkpoint control, default true | 
Definition at line 380 of file checkpoint_control.hpp.
References _input_array, _offset_by_identifier, add_object(), and XASSERTM.
| 
 | inline | 
Save checkpoint to a stream.
Save a checkpoint, holding the current status of all registered objects, in a BinaryStream
| [in] | bs | BinaryStream that shall be written to | 
Definition at line 467 of file checkpoint_control.hpp.
References _collect_checkpoint_data().
| 
 | inline | 
Write checkpoint file to disk.
Write one uncompressed binary file: filename: [name.cp]: holding the current status of all checkpointable objects added to the checkpoint control
| [in] | filename | String holding the complete name of the file with extension .cp | 
Definition at line 407 of file checkpoint_control.hpp.
| 
 | inline | 
Set a new serialize configuration.
| [in] | conf | LAFEM::SerialConfig, a config class holding information about the compression parameters. | 
Set a new SerialConfig object.
Definition at line 303 of file checkpoint_control.hpp.
References _config.
| 
 | private | 
Mapping of identifier string to pointer to the checkpointable object.
Definition at line 144 of file checkpoint_control.hpp.
Referenced by _collect_checkpoint_data(), add_object(), get_identifier_list(), and remove_object().
| 
 | private | 
the mpi communicator identifying our mpi context
Definition at line 150 of file checkpoint_control.hpp.
| 
 | private | 
The config class that controls the compression modes.
Definition at line 152 of file checkpoint_control.hpp.
Referenced by _collect_checkpoint_data(), and set_config().
| 
 | private | 
Vector holding the array read from the input file during restore.
Definition at line 146 of file checkpoint_control.hpp.
Referenced by CheckpointControl(), _load(), _restore_checkpoint_data(), clear_input(), load(), and restore_object().
| 
 | private | 
Mapping of identifier string to the offset in the input file.
Definition at line 148 of file checkpoint_control.hpp.
Referenced by _restore_checkpoint_data(), clear_input(), and restore_object().