Checkpoint
-
class Checkpoint
Save the state of a class in memory by writing to disk, such that the checkpoint file can be later read to restart the simulation. Note that for OMP or parallel simulations, the number of hours is multiplied by the number of threads.
To restart a simulation from a checkpoint file, checkpoint.fst, use the following BASH command:
echo “Restart checkpoint.fst” | $HOME/feasst(-version)/build/bin/fst
Note that more commands may be added afted the line “Restart checkpoint.fst”
Arguments
num_hours: Number of hours between printing of checkpoint file (default: 1).
num_hours_terminate: Terminate after this many hours. If -1, do not terminate (default: -1). Termination may be detected in Bash shell using “$? != 0”.
checkpoint_file: The default is one space (e.g., “ “). Do not checkpoint if checkpoint_file is empty or is one space.
writes_per_backup: Create a unique checkpoint file name every this many times that a checkpoint is written (default: -1). If -1, only backup the previous file by appending its name with “.bak”. Otherwise, if > 0, append each backup with an integer count beginning with 0.
Public Functions
-
double num_hours() const
Return number of hours between writing file.
-
template<typename T>
void write(const T &obj, const std::string append_backup = ".bak") const Write the checkpoint to file. If the file exists, create backup.
-
template<typename T>
void check(const T &obj) Write object to checkpoint_file if num_hours has passed since previous.
-
void serialize(std::ostream &ostr) const
Serialize object.
-
Checkpoint(std::istream &istr)
Deserialize object.