Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
35550f2
Refactor Sparta checkpointers
colby-nyce Aug 7, 2025
e15c30d
Database-backed checkpointer
colby-nyce Aug 8, 2025
bc571e8
Database-backed checkpointer
colby-nyce Aug 12, 2025
ed2e9b8
Database-backed checkpointer
colby-nyce Aug 20, 2025
8d404a1
Database-backed checkpointer
colby-nyce Aug 20, 2025
81002a6
Database-backed checkpointer
colby-nyce Aug 20, 2025
146c59f
Database-backed checkpointer
colby-nyce Aug 26, 2025
5cfeb76
Database-backed checkpointer
colby-nyce Aug 26, 2025
830c463
Database-backed checkpointer
colby-nyce Sep 16, 2025
7011a13
Merge branch 'master' of github-personal.com:colby-nyce/map into colb…
colby-nyce Sep 16, 2025
57dccf4
Last set of changes before redesign
colby-nyce Sep 17, 2025
b0b9d0b
Database-backed checkpointer
colby-nyce Sep 22, 2025
5398d34
Database-backed checkpointer
colby-nyce Sep 23, 2025
4203aae
Update all doxygen and add more testing
colby-nyce Sep 23, 2025
0db5b77
Fix clang build/regress failures
colby-nyce Sep 23, 2025
ce66f17
Fix clang build/regress failures
colby-nyce Sep 23, 2025
2200014
Attempt to fix -LE issue with ctest (macos)
colby-nyce Sep 23, 2025
6a5c9f7
Align the apple/valgrind/ctest code in the test dir and example dir
colby-nyce Sep 23, 2025
a349441
Redirect std::cerr to a logfile for the Buffer_test
colby-nyce Sep 23, 2025
c33d525
Merge branch 'master' of github-personal.com:colby-nyce/map into colb…
colby-nyce Sep 24, 2025
ce62a4d
Address PR feedback
colby-nyce Sep 25, 2025
0ae3bff
Address PR feedback
colby-nyce Sep 25, 2025
81b874d
Remove old debug code
colby-nyce Sep 25, 2025
6efd3a5
Add DatabaseCheckpointer::findLatestCheckpointAtOrBefore()
colby-nyce Sep 25, 2025
4a4ac84
Remove O(n) code from ensureWindowLoaded_
colby-nyce Sep 25, 2025
a8ec19d
Re-enable Buffer_test
colby-nyce Sep 25, 2025
713c8aa
Move DatabaseCheckpoint test dir
colby-nyce Sep 25, 2025
967a50f
Change variable name in unit test
colby-nyce Sep 25, 2025
4e43e97
Bump SimDB
colby-nyce Sep 29, 2025
ce464b9
Bump SimDB
colby-nyce Sep 30, 2025
a7c7228
PR feedback
colby-nyce Sep 30, 2025
656e8bf
Bump SimDB
colby-nyce Sep 30, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions sparta/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ list (APPEND SourceCppFiles
src/CounterBase.cpp
src/CsvFormatter.cpp
src/DAG.cpp
src/DatabaseCheckpoint.cpp
src/DatabaseCheckpointer.cpp
src/Destination.cpp
src/EdgeFactory.cpp
src/EventNode.cpp
Expand Down
2 changes: 1 addition & 1 deletion sparta/simdb
Submodule simdb updated from 394f8b to d35c99
3 changes: 2 additions & 1 deletion sparta/sparta/resources/Buffer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,9 @@ namespace sparta

public:
DataPointer() { }
~DataPointer() { }

DataPointer(DataPointer &&orig) {
DataPointer(DataPointer &&orig) noexcept {
::memcpy(&object_memory_, &orig.object_memory_, sizeof(object_memory_));
data = reinterpret_cast<value_type*>(&object_memory_);
}
Expand Down
173 changes: 31 additions & 142 deletions sparta/sparta/serialization/checkpoint/Checkpoint.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,10 @@

#pragma once

#include <iostream>
#include <sstream>

#include "sparta/functional/ArchData.hpp"
#include "sparta/utils/SpartaException.hpp"
#include "sparta/utils/SpartaAssert.hpp"
#include "sparta/kernel/Scheduler.hpp"

#include "sparta/serialization/checkpoint/CheckpointExceptions.hpp"

#include "sparta/serialization/checkpoint/CheckpointBase.hpp"

namespace sparta::serialization::checkpoint
{
class FastCheckpointer;

/*!
* \brief Single checkpoint object interface with a tick number and an ID
* unique to the owning Checkpointer instance
Expand All @@ -25,35 +14,10 @@ namespace sparta::serialization::checkpoint
* checkpoint data in memory or on disk at construction which can be
* restored with load()
*/
class Checkpoint
class Checkpoint : public CheckpointBase
{
public:

//! \name Local Types
//! @{
////////////////////////////////////////////////////////////////////////

//! \brief tick_t Tick type to which checkpoints will refer
typedef sparta::Scheduler::Tick tick_t;

//! \brief tick_t Tick type to which checkpoints will refer
typedef uint64_t chkpt_id_t;

////////////////////////////////////////////////////////////////////////
//! @}

/*!
* \brief Indicates the smallest valid checkpoint id
*/
static const chkpt_id_t MIN_CHECKPOINT = 0;

/*!
* \brief Indicates unidentified checkpoint (could mean 'invalid' or
* 'any') depending on context
*/
static const chkpt_id_t UNIDENTIFIED_CHECKPOINT = ~(chkpt_id_t)0;


//! \name Construction & Initialization
//! @{
////////////////////////////////////////////////////////////////////////
Expand All @@ -65,7 +29,13 @@ namespace sparta::serialization::checkpoint
Checkpoint(const Checkpoint&) = delete;

//! \brief Non-assignable
const Checkpoint& operator=(const Checkpoint&) = delete;
Checkpoint& operator=(const Checkpoint&) = delete;

//! \brief Not move constructable
Checkpoint(Checkpoint&&) = delete;

//! \brief Not move assignable
Checkpoint& operator=(Checkpoint&&) = delete;

protected:

Expand All @@ -75,18 +45,14 @@ namespace sparta::serialization::checkpoint
Checkpoint(chkpt_id_t id,
tick_t tick,
Checkpoint* prev) :
tick_(tick),
chkpt_id_(id),
CheckpointBase(id, tick),
prev_(prev)
{ }

public:


/*!
* \brief Destructor
*
* Removes this checkpoint from the chain and patches chain between prev
* \brief Removes this checkpoint from the chain and patches chain between prev
* and each item in the nexts list
*/
virtual ~Checkpoint() {
Expand All @@ -101,72 +67,11 @@ namespace sparta::serialization::checkpoint
getPrev()->addNext(d);
}
}

}

////////////////////////////////////////////////////////////////////////
//! @}

/*!
* \brief Returns a string describing this object
*/
virtual std::string stringize() const {
std::stringstream ss;
ss << "<Checkpoint id=" << chkpt_id_ << " at t=" << tick_;
ss << ' ' << getTotalMemoryUse()/1000.0f << "kB (" << getContentMemoryUse()/1000.0f << "kB Data)";
ss << '>';
return ss.str();
}

/*!
* \brief Writes all checkpoint raw data to an ostream
* \param o ostream to which raw data will be written
* \note No newlines or other extra characters will be appended
*/
virtual void dumpData(std::ostream& o) const = 0;

/*!
* \brief Returns memory usage by this checkpoint including any
* framework data structures
*/
virtual uint64_t getTotalMemoryUse() const noexcept = 0;

/*!
* \brief Returns memory usage by this checkpoint solely for the
* checkpointed content.
*/
virtual uint64_t getContentMemoryUse() const noexcept = 0;

//! \name Checkpoint Actions
//! @{
////////////////////////////////////////////////////////////////////////

/*!
* \brief Attempts to restore this checkpoint state to the simulation
* state (ArchData) objects given to this Checkpoint at construction
*/
virtual void load(const std::vector<ArchData*>& dats) = 0;

/*!
* \brief Returns the tick number at which this checkpoint was taken.
*/
tick_t getTick() const noexcept { return tick_; }

/*!
* \brief Returns the ID of this checkpoint
* \note Number has no sequential meaning - it is effectively a random
* ID.
*/
chkpt_id_t getID() const noexcept { return chkpt_id_; }

/*!
* \brief Gets the representation of this deleted checkpoint as part of
* a checkpoint chain (if that checkpointer supports deletion)
*/
virtual std::string getDeletedRepr() const {
return "*";
}

/*!
* \brief Returns the previous checkpoint. If this checkpoint is a
* snapshot, it has no previous checkpoint.
Expand All @@ -177,14 +82,22 @@ namespace sparta::serialization::checkpoint

/*!
* \brief Sets the previous checkpoint of this checkpoint to \a prev
* \param prev New previou checkpoint. Overwrites previous
* \param prev New previous checkpoint. Overwrites previous
* This will often be accompanied by a call to addNext on the
* \a prev argument
*/
void setPrev(Checkpoint* prev) noexcept {
prev_ = prev;
}

/*!
* \brief Get the ID of our previous checkpoint. Returns UNIDENTIFIED_CHECKPOINT
* only for the head checkpoint.
*/
chkpt_id_t getPrevID() const override {
return prev_ ? prev_->getID() : UNIDENTIFIED_CHECKPOINT;
}

/*!
* \brief Adds another next checkpoint following *this.
* \param next Next checkpoint (later in simulator ticks) than
Expand Down Expand Up @@ -242,22 +155,22 @@ namespace sparta::serialization::checkpoint
*/
const std::vector<Checkpoint*>& getNexts() const noexcept { return nexts_; }

////////////////////////////////////////////////////////////////////////
//! @}

protected:

/*!
* \brief Sets the checkpoint ID.
* \brief Returns next checkpoint following *this. May be an empty
* vector if there are no later checkpoints.
*/
void setID_(chkpt_id_t id) {
chkpt_id_ = id;
std::vector<chkpt_id_t> getNextIDs() const override {
std::vector<chkpt_id_t> next_ids;
for (const auto chkpt : getNexts()) {
next_ids.push_back(chkpt->getID());
}
return next_ids;
}

private:
////////////////////////////////////////////////////////////////////////
//! @}

const tick_t tick_; //!< Tick number for this checkpoint.
chkpt_id_t chkpt_id_; //!< This checkpoint's ID. Guaranteed to be unique from other checkpoints'
private:

/*!
* \brief Next checkpoint (later tick numbers in same forward stream of
Expand All @@ -270,27 +183,3 @@ namespace sparta::serialization::checkpoint
};

} // namespace sparta::serialization::checkpoint


//! ostream insertion operator for Checkpoint
inline std::ostream& operator<<(std::ostream& o, const sparta::serialization::checkpoint::Checkpoint& dcp){
o << dcp.stringize();
return o;
}

//! ostream insertion operator for Checkpoint
inline std::ostream& operator<<(std::ostream& o, const sparta::serialization::checkpoint::Checkpoint* dcp){
if(dcp == 0){
o << "null";
}else{
o << dcp->stringize();
}
return o;
}

//! \brief Required in simulator source to define some globals.
#define SPARTA_CHECKPOINT_BODY \
namespace sparta{ namespace serialization { namespace checkpoint { \
const Checkpoint::chkpt_id_t Checkpoint::MIN_CHECKPOINT; \
const Checkpoint::chkpt_id_t Checkpoint::UNIDENTIFIED_CHECKPOINT; \
}}}
Loading
Loading