The Sparta Modeling Framework
Loading...
Searching...
No Matches
sparta::DAG Class Reference

Classes

class  CycleException
 

Public Types

typedef Vertex GOPoint
 
typedef std::map< std::string, Vertex * > VertexMap
 

Public Member Functions

 DAG (sparta::Scheduler *scheduler, const bool &check_cycles=false)
 
void enableEarlyCycleDetect ()
 
void initializeDAG_ ()
 Initialize the DAG Creates new vertices from the VertexFactory and links them according to precedence.
 
uint32_t finalize ()
 Finialize the DAG.
 
bool isFinalized () const
 Is the DAG finalized?
 
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 set, before the Scheduleable is assigned/linked to a DAG phase.
 
void link (Vertex *v, Vertex *w, const std::string &reason="")
 link(): Establish a precedence relationship between two entities. This method will wrap the Scheduleables with Vertices so that they can be manipulated by the DAG
 
bool unlink (Vertex *v, Vertex *w)
 
uint32_t numGroups ()
 
bool sort ()
 
Vertex * findGOPVertex (const std::string &label) const
 Find a GOP point.
 
Vertex * newGOPVertex (const std::string &label, sparta::Scheduler *const scheduler)
 Create a new Vertex-GOP point.
 
Vertex * getGOPoint (const std::string &label)
 Get the named GOP point; create it if not found.
 
sparta::SchedulergetScheduler () const
 
bool detectCycle () const
 Look for cycles.
 
void printCycles (std::ostream &os) const
 
void dumpToCSV (std::ostream &os_vertices, std::ostream &os_edges) const
 Dump the DAG to a CSV vertices file and an edges file.
 
void print (std::ostream &os) const
 Print the DAG.
 

Friends

std::ostream & operator<< (std::ostream &os, const Edge &e)
 
std::ostream & operator<< (std::ostream &os, const Vertex &v)
 

Detailed Description

Definition at line 38 of file DAG.hpp.

Member Typedef Documentation

◆ GOPoint

typedef Vertex sparta::DAG::GOPoint

Definition at line 49 of file DAG.hpp.

◆ VertexMap

typedef std::map<std::string, Vertex*> sparta::DAG::VertexMap

Definition at line 50 of file DAG.hpp.

Member Function Documentation

◆ enableEarlyCycleDetect()

void sparta::DAG::enableEarlyCycleDetect ( )
inline

Turn on early cycle detection – as items are linked in the DAG, it will look for a cycle.

Definition at line 83 of file DAG.hpp.

◆ finalize()

uint32_t sparta::DAG::finalize ( )

Finialize the DAG.

Returns
The number of groups that were created

◆ findGOPVertex()

Vertex * sparta::DAG::findGOPVertex ( const std::string &  label) const
inline

Find a GOP point.

Parameters
labelThe GOP point to create
Returns
the GOP point; nullptr if not found

Definition at line 151 of file DAG.hpp.

◆ getGOPoint()

Vertex * sparta::DAG::getGOPoint ( const std::string &  label)
inline

Get the named GOP point; create it if not found.

Parameters
labelThe GOP point to find or create
Returns
the GOP point, never nullptr

Definition at line 177 of file DAG.hpp.

Here is the call graph for this function:

◆ getScheduler()

sparta::Scheduler * sparta::DAG::getScheduler ( ) const
inline

Definition at line 186 of file DAG.hpp.

◆ isFinalized()

bool sparta::DAG::isFinalized ( ) const
inline

Is the DAG finalized?

Definition at line 99 of file DAG.hpp.

◆ link()

void sparta::DAG::link ( Vertex *  v,
Vertex *  w,
const std::string &  reason = "" 
)

link(): Establish a precedence relationship between two entities. This method will wrap the Scheduleables with Vertices so that they can be manipulated by the DAG

Parameters
sourceThe Vertex from
destThe Vertex to
reasonThe reason for the link
Exceptions
CycleExceptionif the new link will cause a DAG cycle

link(v,w) will introduce an edge from source to dest, so that source precedes dest (and after sort, source's group ID will be less than dest's)

◆ newFactoryVertex()

Vertex * sparta::DAG::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 set, before the Scheduleable is assigned/linked to a DAG phase.

Returns
The new Vertex contained in a Scheduleable.

◆ newGOPVertex()

Vertex * sparta::DAG::newGOPVertex ( const std::string &  label,
sparta::Scheduler *const  scheduler 
)
inline

Create a new Vertex-GOP point.

Exceptions
Willassert if already exists
Parameters
labelThe GOP point to create
schedulerThe Scheduler associated with this Vertex
Returns
the new GOP point; assert if already exists

Definition at line 164 of file DAG.hpp.

Here is the call graph for this function:

◆ numGroups()

uint32_t sparta::DAG::numGroups ( )
inline

Definition at line 140 of file DAG.hpp.

◆ unlink()

bool sparta::DAG::unlink ( Vertex *  v,
Vertex *  w 
)
inline

Definition at line 132 of file DAG.hpp.


The documentation for this class was generated from the following file: