5#include "sparta/serialization/checkpoint/FastCheckpointer.hpp"
7#include "simdb/apps/App.hpp"
8#include "simdb/utils/ConcurrentQueue.hpp"
17namespace simdb::pipeline
22namespace sparta::serialization::checkpoint
29 using checkpoint_ptr =
typename FastCheckpointer::checkpoint_ptr;
30 using checkpoint_ptrs =
typename FastCheckpointer::checkpoint_ptrs;
32 using arch_id_t = uint64_t;
35 static constexpr auto NAME =
"cherry-pick-fast-checkpointer";
76 AppT* createApp(simdb::DatabaseManager* db_mgr)
override
79 return new AppT(db_mgr, roots_, scheduler_);
82 void defineSchema(simdb::Schema& schema)
const override
88 std::vector<TreeNode*> roots_;
106 return checkpointer_;
143 arch_id_t start_arch_id = UINT64_MAX;
144 arch_id_t end_arch_id = UINT64_MAX;
145 tick_t start_tick = UINT64_MAX;
146 tick_t end_tick = UINT64_MAX;
147 checkpoint_ptrs checkpoints;
149 template <
typename Archive>
150 void serialize(Archive & ar,
const unsigned int ) {
156 if (checkpoints.empty()) {
158 const auto num_chkpts = end_arch_id - start_arch_id + 1;
159 for (
size_t i = 0; i < num_chkpts; ++i) {
160 checkpoints.emplace_back(
new checkpoint_type);
161 ar & *checkpoints.back();
165 for (
auto& chkpt : checkpoints) {
173 arch_id_t start_arch_id = UINT64_MAX;
174 arch_id_t end_arch_id = UINT64_MAX;
175 tick_t start_tick = UINT64_MAX;
176 tick_t end_tick = UINT64_MAX;
177 size_t num_chkpts = 0;
178 std::vector<char> chkpt_bytes;
183 simdb::DatabaseManager* db_mgr_ =
nullptr;
184 simdb::ConcurrentQueue<ChkptWindow>* pipeline_head_ =
nullptr;
185 std::unique_ptr<simdb::pipeline::Flusher> pipeline_flusher_;
Exception class for all of Sparta.
A class that lets you schedule events now and in the future.
Checkpoint::chkpt_id_t chkpt_id_t
tick_t Tick type to which checkpoints will refer
Checkpoint::tick_t tick_t
tick_t Tick type to which checkpoints will refer
This AppFactory specialization is provided since we have to initialize the FastCheckpointer which tak...
void parameterize(const std::vector< TreeNode * > &roots, Scheduler *sched=nullptr)
Sets the ArchData root(s) and Scheduler for a given instance of the checkpointer.
static void defineSchema(simdb::Schema &schema)
Define the SimDB schema for this checkpointer.
std::string stringize() const
Returns a string describing this object.
void saveCheckpoints(checkpoint_ptrs &&checkpoints)
Send the committed checkpoints down the pipeline to the database.
void createPipeline(simdb::pipeline::PipelineManager *pipeline_mgr) override
Instantiate the async processing pipeline to save checkpoints to the DB.
CherryPickFastCheckpointer(simdb::DatabaseManager *db_mgr, const std::vector< TreeNode * > &roots, Scheduler *sched=nullptr)
CherryPickFastCheckpointer constructor.
FastCheckpointer & getFastCheckpointer() noexcept
Use the FastCheckpointer to create checkpoints / checkpoint branches.
void commitCurrentBranch(bool force_new_head_chkpt=false)
When satisfied with the outstanding/uncommitted checkpoints, call this method to commit them to the d...
size_t getNumCheckpoints() const
Get the total number of checkpoints sent to the database thus far.
Single delta checkpoint object containing all simulator state which changed since some previous Delta...
Implements quick checkpointing through delta-checkpoint trees which store state-deltas in a compact f...
Macros for handling exponential backoff.