29#include "sparta/kernel/Vertex.hpp"
30#include "sparta/kernel/VertexFactory.hpp"
31#include "sparta/kernel/EdgeFactory.hpp"
41 friend std::ostream& operator<<(std::ostream& os,
const Edge &e);
42 friend std::ostream&
operator<<(std::ostream& os,
const Vertex &v);
49 typedef Vertex GOPoint;
50 typedef std::map<std::string, Vertex*> VertexMap;
64 void writeCycleAsDOT (std::ostream & os)
const;
65 void writeCycleAsText (std::ostream & os)
const;
69 typename Vertex::VertexList cycle_set_;
84 early_cycle_detect_ =
true;
112 const bool isgop=
false);
130 void link(Vertex *v, Vertex *w,
const std::string & reason =
"");
132 bool unlink(Vertex *v, Vertex *w)
137 return v->unlink(e_factory_, w);
140 uint32_t numGroups() {
153 auto loc = gops_.find(label);
154 return (loc != gops_.end()) ? loc->second :
nullptr;
180 if (gop ==
nullptr) {
187 return my_scheduler_;
194 void printCycles(std::ostream& os)
const;
197 void dumpToCSV(std::ostream& os_vertices, std::ostream& os_edges)
const;
204 typename Vertex::VertexList getCycles_();
209 for (
auto& i : gops_) {
210 i.second->transferGID();
215 VertexFactory v_factory_;
216 EdgeFactory e_factory_;
218 std::vector<Vertex*> alloc_vertices_;
219 uint32_t num_groups_ = 1;
220 bool early_cycle_detect_;
222 bool finalized_ =
false;
224 const log::MessageSource debug_logger_;
228 inline std::ostream&
operator<<(std::ostream& os,
const DAG &d)
234 inline std::ostream&
operator<<(std::ostream& os,
const DAG *d)
File that defines the Scheduleable class.
File that defines the phases used in simulation.
Set of macros for Sparta assertions. Caught by the framework.
#define sparta_assert(...)
Simple variadic assertion that will throw a sparta_exception if the condition fails.
Exception class for all of Sparta.
Vertex * getGOPoint(const std::string &label)
Get the named GOP point; create it if not found.
bool detectCycle() const
Look for cycles.
void link(Vertex *v, Vertex *w, const std::string &reason="")
link(): Establish a precedence relationship between two entities. This method will wrap the Schedulea...
Vertex * findGOPVertex(const std::string &label) const
Find a GOP point.
void enableEarlyCycleDetect()
Vertex * newFactoryVertex(const std::string &label, sparta::Scheduler *const scheduler, const bool isgop=false)
Get a new Vertex from the DAGs Vertex Factory Called in a Scheduleable after the scheduler_ has been ...
void initializeDAG_()
Initialize the DAG Creates new vertices from the VertexFactory and links them according to precedence...
void print(std::ostream &os) const
Print the DAG.
void dumpToCSV(std::ostream &os_vertices, std::ostream &os_edges) const
Dump the DAG to a CSV vertices file and an edges file.
Vertex * newGOPVertex(const std::string &label, sparta::Scheduler *const scheduler)
Create a new Vertex-GOP point.
uint32_t finalize()
Finialize the DAG.
bool isFinalized() const
Is the DAG finalized?
A class that lets you schedule events now and in the future.
Used to construct and throw a standard C++ exception. Inherits from std::exception.
SpartaException()
Construct a SpartaException object with empty reason.
The is the base class for user defined blocks in simulation.
Macros for handling exponential backoff.
std::ostream & operator<<(std::ostream &o, const SimulationInfo &info)
ostream insertion operator for SimulationInfo