| The Gaudi Framework v27r1

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Private Attributes | List of all members
concurrency::ExecutionFlowManager Class Reference

Manage the execution flow using an execution flow graph Once initialized, the graph is const and can be shared across events. More...

`#include <GaudiHive/src/ExecutionFlowManager.h>`

Inheritance diagram for concurrency::ExecutionFlowManager:
[legend]
Collaboration diagram for concurrency::ExecutionFlowManager:
[legend]

## Public Member Functions
| ExecutionFlowManager ()
| Constructor. More...
| ~ExecutionFlowManager () override=default
| Destructor. More...
StatusCode | initialize (ExecutionFlowGraph *CFGraph, const std::unordered_map< std::string, unsigned int > &algname_index_map)
| Initialize the control flow manager It greps the topalg list and the index map for the algo names. More...
StatusCode | initialize (ExecutionFlowGraph *CFGraph, const std::unordered_map< std::string, unsigned int > &algname_index_map, std::vector< EventSlot > &eventSlots, const std::string &mode)
void | simulateExecutionFlow (IGraphVisitor &visitor) const
ExecutionFlowGraph * | getExecutionFlowGraph () const
| Get the flow graph instance. More...
bool | needsAlgorithmToRun (const unsigned int iAlgo) const
| A little bit silly, but who cares. ;-) More...
void | updateEventState (AlgsExecutionStates &algo_states, std::vector< int > &node_decisions) const
| Update the state of algorithms to controlready, where possible. More...
void | updateDecision (const std::string &algo_name, const int &slotNum, AlgsExecutionStates &states, std::vector< int > &node_decisions) const
void | updateEventState (AlgsExecutionStates &algo_states) const
| XXX: CF tests. More...
void | promoteToControlReadyState (AlgsExecutionStates &algo_states, std::vector< int > &node_decisions, const int &slotNum=-1) const
| XXX: CF tests. More...
bool | algoDataDependenciesSatisfied (const std::string &algo_name, const int &slotNum) const
| Check all data dependencies of an algorithm are satisfied. More...
bool | rootDecisionResolved (const std::vector< int > &node_decisions) const
| Check whether root decision was resolved. More...
void | printEventState (std::stringstream &ss, AlgsExecutionStates &states, const std::vector< int > &node_decisions, const unsigned int &recursionLevel) const
| Print the state of the control flow for a given event. More...
void | touchReadyAlgorithms (IGraphVisitor &visitor) const
| Promote all algorithms, ready to be executed, to DataReady state. More...
const std::string & | name () const override
| Retrieve name of the service. More...
SmartIF< ISvcLocator > & | serviceLocator () const override
| Retrieve pointer to service locator. More...
Public Member Functions inherited from CommonMessagingBase
virtual | ~CommonMessagingBase ()=default
| Virtual destructor. More...
SmartIF< IMessageSvc > & | msgSvc () const
| The standard message service. More...
MsgStream & | msgStream () const
| Return an uninitialized MsgStream. More...
MsgStream & | msgStream (const MSG::Level level) const
| Predefined configurable message stream for the efficient printouts. More...
MsgStream & | always () const
| shortcut for the method msgStream(MSG::ALWAYS) More...
MsgStream & | fatal () const
| shortcut for the method msgStream(MSG::FATAL) More...
MsgStream & | err () const
| shortcut for the method msgStream(MSG::ERROR) More...
MsgStream & | error () const
| shortcut for the method msgStream(MSG::ERROR) More...
MsgStream & | warning () const
| shortcut for the method msgStream(MSG::WARNING) More...
MsgStream & | info () const
| shortcut for the method msgStream(MSG::INFO) More...
MsgStream & | debug () const
| shortcut for the method msgStream(MSG::DEBUG) More...
MsgStream & | verbose () const
| shortcut for the method msgStream(MSG::VERBOSE) More...
MsgStream & | msg () const
| shortcut for the method msgStream(MSG::INFO) More...
MSG::Level | msgLevel () const
| get the output level from the embedded MsgStream More...
MSG::Level | outputLevel () const __attribute__((deprecated))
| Backward compatibility function for getting the output level. More...
bool | msgLevel (MSG::Level lvl) const
| get the output level from the embedded MsgStream More...

## Private Attributes
std::string | m_name
ExecutionFlowGraph * | m_EFGraph
| the control flow graph More...

## Additional Inherited Members
Public Types inherited from CommonMessaging< IExecutionFlowManager >
using | base_class = CommonMessaging
Protected Member Functions inherited from CommonMessaging< IExecutionFlowManager >
void | updateMsgStreamOutputLevel (int level)
| Update the output level of the cached MsgStream. More...

## Detailed Description

Manage the execution flow using an execution flow graph Once initialized, the graph is const and can be shared across events.

Author
  Benedikt Hegner
  Illya Shapoval

Definition at line 21 of file ExecutionFlowManager.h.

## Constructor & Destructor Documentation

concurrency::ExecutionFlowManager::ExecutionFlowManager | ( |  | ) |
| inline

Constructor.

Definition at line 24 of file ExecutionFlowManager.h.

24 : m_name("ExecutionFlowManager"), m_EFGraph(0) {};
concurrency::ExecutionFlowManager::m_name
std::string m_name
Definition: ExecutionFlowManager.h:71
concurrency::ExecutionFlowManager::m_EFGraph
ExecutionFlowGraph * m_EFGraph
the control flow graph
Definition: ExecutionFlowManager.h:73

concurrency::ExecutionFlowManager::~ExecutionFlowManager | ( |  | ) |
| override default

Destructor.

## Member Function Documentation

bool concurrency::ExecutionFlowManager::algoDataDependenciesSatisfied | ( | const std::string & | algo_name,
|  | const int & | slotNum
| ) |  | const

Check all data dependencies of an algorithm are satisfied.

Definition at line 116 of file ExecutionFlowManager.cpp.

116 {
117 return m_EFGraph->getAlgorithmNode(algo_name)->dataDependenciesSatisfied(slotNum);
118 }
concurrency::AlgorithmNode::dataDependenciesSatisfied
bool dataDependenciesSatisfied(const int &slotNum) const
Method to check whether the Algorithm has its all data dependency satisfied.
Definition: ExecutionFlowGraph.cpp:264
concurrency::ExecutionFlowManager::m_EFGraph
ExecutionFlowGraph * m_EFGraph
the control flow graph
Definition: ExecutionFlowManager.h:73
concurrency::ExecutionFlowGraph::getAlgorithmNode
AlgorithmNode * getAlgorithmNode(const std::string &algoName) const
Get the AlgorithmNode from by algorithm name using graph index.
Definition: ExecutionFlowGraph.cpp:614

ExecutionFlowGraph* concurrency::ExecutionFlowManager::getExecutionFlowGraph | ( |  | ) | const
| inline

Get the flow graph instance.

Definition at line 38 of file ExecutionFlowManager.h.

38 {return m_EFGraph;}
concurrency::ExecutionFlowManager::m_EFGraph
ExecutionFlowGraph * m_EFGraph
the control flow graph
Definition: ExecutionFlowManager.h:73

StatusCode concurrency::ExecutionFlowManager::initialize | ( | ExecutionFlowGraph * | CFGraph,
|  | const std::unordered_map< std::string, unsigned int > & | algname_index_map
| ) |  |

Initialize the control flow manager It greps the topalg list and the index map for the algo names.

Definition at line 6 of file ExecutionFlowManager.cpp.

7 {
8 m_EFGraph = ef_graph;
9 StatusCode sc = ef_graph->initialize(algname_index_map);
10 if (!sc.isSuccess())
11 error() << "Could not initialize the flow graph." << endmsg;
12
13 return sc;
14 }
StatusCode::isSuccess
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:76
merge_files.sc
int sc
Definition: merge_files.py:167
CommonMessagingBase::error
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Definition: CommonMessaging.h:118
concurrency::ExecutionFlowManager::m_EFGraph
ExecutionFlowGraph * m_EFGraph
the control flow graph
Definition: ExecutionFlowManager.h:73
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244

StatusCode concurrency::ExecutionFlowManager::initialize | ( | ExecutionFlowGraph * | CFGraph,
|  | const std::unordered_map< std::string, unsigned int > & | algname_index_map,
|  | std::vector< EventSlot > & | eventSlots,
|  | const std::string & | mode
| ) |  |

Definition at line 17 of file ExecutionFlowManager.cpp.

20 {
21 m_EFGraph = ef_graph;
22 StatusCode sc = ef_graph->initialize(algname_index_map, eventSlots);
23 if (!sc.isSuccess()) {
24 error() << "Could not initialize the execution flow graph." << endmsg;
25 return sc;
26 }
27
28 // Rank algorithms if any known optimization mode is supplied
29 if (mode == "PCE") {
30 auto ranker = concurrency::RankerByProductConsumption();
31 m_EFGraph->rankAlgorithms(ranker);
32 } else if (mode == "COD") {
33 auto ranker = concurrency::RankerByCummulativeOutDegree();
34 m_EFGraph->rankAlgorithms(ranker);
35 } else if (mode == "E") {
36 auto ranker = concurrency::RankerByEccentricity();
37 m_EFGraph->rankAlgorithms(ranker);
38 } else if (mode == "T") {
39 auto ranker = concurrency::RankerByTiming();
40 m_EFGraph->rankAlgorithms(ranker);
41 } else if (mode == "DRE") {
42 auto ranker = concurrency::RankerByDataRealmEccentricity();
43 m_EFGraph->rankAlgorithms(ranker);
44 } else if (!mode.empty()){
45 error() << "Requested optimization mode '" << mode << "' is not known." << endmsg;
46 sc = StatusCode::FAILURE;
47 }
48
49 return sc;
50 }
std::string::empty
T empty(T...args)
StatusCode::isSuccess
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:76
merge_files.sc
int sc
Definition: merge_files.py:167
CommonMessagingBase::error
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Definition: CommonMessaging.h:118
concurrency::RankerByTiming
Definition: EFGraphVisitors.h:118
concurrency::RankerByDataRealmEccentricity
Definition: EFGraphVisitors.h:170
StatusCode::FAILURE
Definition: StatusCode.h:29
concurrency::ExecutionFlowManager::m_EFGraph
ExecutionFlowGraph * m_EFGraph
the control flow graph
Definition: ExecutionFlowManager.h:73
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
concurrency::RankerByEccentricity
Definition: EFGraphVisitors.h:144
concurrency::ExecutionFlowGraph::rankAlgorithms
void rankAlgorithms(IGraphVisitor &ranker) const
Rank Algorithm nodes by the number of data outputs.
Definition: ExecutionFlowGraph.cpp:708
concurrency::RankerByProductConsumption
Definition: EFGraphVisitors.h:64
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
concurrency::RankerByCummulativeOutDegree
Definition: EFGraphVisitors.h:90

const std::string& concurrency::ExecutionFlowManager::name | ( |  | ) | const
| inline override

Retrieve name of the service.

Definition at line 67 of file ExecutionFlowManager.h.

67 {return m_name;}
concurrency::ExecutionFlowManager::m_name
std::string m_name
Definition: ExecutionFlowManager.h:71

bool concurrency::ExecutionFlowManager::needsAlgorithmToRun | ( | const unsigned int | iAlgo | ) | const

A little bit silly, but who cares. ;-)

void concurrency::ExecutionFlowManager::printEventState | ( | std::stringstream & | ss,
|  | AlgsExecutionStates & | states,
|  | const std::vector< int > & | node_decisions,
|  | const unsigned int & | recursionLevel
| ) |  | const
| inline

Print the state of the control flow for a given event.

Definition at line 60 of file ExecutionFlowManager.h.

63 {m_EFGraph->printState(ss,states,node_decisions,recursionLevel);}
concurrency::ExecutionFlowManager::m_EFGraph
ExecutionFlowGraph * m_EFGraph
the control flow graph
Definition: ExecutionFlowManager.h:73
concurrency::ExecutionFlowGraph::printState
void printState(std::stringstream &output, AlgsExecutionStates &states, const std::vector< int > &node_decisions, const unsigned int &recursionLevel) const
Print a string representing the control flow state.
Definition: ExecutionFlowGraph.h:324

void concurrency::ExecutionFlowManager::promoteToControlReadyState | ( | AlgsExecutionStates & | algo_states,
|  | std::vector< int > & | node_decisions,
|  | const int & | slotNum = `-1`
| ) |  | const

XXX: CF tests.

Definition at line 109 of file ExecutionFlowManager.cpp.

111 {
112 m_EFGraph->m_headNode->promoteToControlReadyState(slotNum, algo_states, node_decisions);
113 }
concurrency::ExecutionFlowGraph::m_headNode
DecisionNode * m_headNode
the head node of the control flow graph; may want to have multiple ones once supporting trigger paths...
Definition: ExecutionFlowGraph.h:349
concurrency::ExecutionFlowManager::m_EFGraph
ExecutionFlowGraph * m_EFGraph
the control flow graph
Definition: ExecutionFlowManager.h:73
concurrency::DecisionNode::promoteToControlReadyState
virtual bool promoteToControlReadyState(const int &slotNum, AlgsExecutionStates &states, std::vector< int > &node_decisions) const
XXX: CF tests. Method to set algos to CONTROLREADY, if possible.
Definition: ExecutionFlowGraph.cpp:155

bool concurrency::ExecutionFlowManager::rootDecisionResolved | ( | const std::vector< int > & | node_decisions | ) | const

Check whether root decision was resolved.

Definition at line 121 of file ExecutionFlowManager.cpp.

121 {
122
123 return (-1 != node_decisions[m_EFGraph->m_headNode->getNodeIndex()]) ? true : false;
124 }
concurrency::ExecutionFlowGraph::m_headNode
DecisionNode * m_headNode
the head node of the control flow graph; may want to have multiple ones once supporting trigger paths...
Definition: ExecutionFlowGraph.h:349
concurrency::ExecutionFlowManager::m_EFGraph
ExecutionFlowGraph * m_EFGraph
the control flow graph
Definition: ExecutionFlowManager.h:73
concurrency::ControlFlowNode::getNodeIndex
const unsigned int & getNodeIndex() const
XXX: CF tests.
Definition: ExecutionFlowGraph.h:70

SmartIF<ISvcLocator>& concurrency::ExecutionFlowManager::serviceLocator | ( |  | ) | const
| inline override

Retrieve pointer to service locator.

Definition at line 69 of file ExecutionFlowManager.h.

69 {return m_EFGraph->serviceLocator();}
concurrency::ExecutionFlowGraph::serviceLocator
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator.
Definition: ExecutionFlowGraph.h:333
concurrency::ExecutionFlowManager::m_EFGraph
ExecutionFlowGraph * m_EFGraph
the control flow graph
Definition: ExecutionFlowManager.h:73

void concurrency::ExecutionFlowManager::simulateExecutionFlow | ( | IGraphVisitor & | visitor | ) | const

Definition at line 53 of file ExecutionFlowManager.cpp.

53 {
54
55 std::vector<int>& nodeDecisions = m_EFGraph->getNodeDecisions(0);
56
57 std::vector<int> fixedNodeDecisions;
58 int cntr = 0;
59 std::vector<int> counters;
60 while (!rootDecisionResolved(nodeDecisions)) {
61 cntr += 1;
62 int prevAlgosNum = visitor.m_nodesSucceeded;
63 debug() << " Proceeding with iteration #" << cntr << endmsg;
64 fixedNodeDecisions = m_EFGraph->getNodeDecisions(0);
65 m_EFGraph->m_headNode->accept(visitor);
66 if ( fixedNodeDecisions == nodeDecisions) {
67 error() << " No progress on iteration " << cntr << " detected" << endmsg;
68 debug() << nodeDecisions << endmsg;
69 break;
70 }
71 info() << " Iteration #" << cntr << " finished, total algorithms executed: " << visitor.m_nodesSucceeded << endmsg;
72
73 std::stringstream s;
74 s << cntr << ", " << (visitor.m_nodesSucceeded-prevAlgosNum) << "\n";
75
76 std::ofstream myfile;
77 myfile.open("RunSimulation.csv", std::ios::app);
78 myfile << s.str();
79 myfile.close();
80
81
82 if (visitor.m_nodesSucceeded != prevAlgosNum)
83 counters.push_back(visitor.m_nodesSucceeded);
84 }
85
86 info() << "Asymptotical concurrency speedup depth: " << (float) visitor.m_nodesSucceeded / (float) counters.size() << endmsg;
87
88 // Reset algorithm states and node decisions
89 m_EFGraph->getAlgoStates(0).reset();
90 nodeDecisions.assign(nodeDecisions.size(),-1);
91
92 }
std::ofstream::open
T open(T...args)
CommonMessagingBase::info
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
Definition: CommonMessaging.h:124
concurrency::DecisionNode::accept
virtual bool accept(IGraphVisitor &visitor)
Definition: ExecutionFlowGraph.cpp:177
concurrency::ExecutionFlowGraph::getNodeDecisions
std::vector< int > & getNodeDecisions(const int &slotNum) const
Definition: ExecutionFlowGraph.h:339
std::stringstream
STL class.
concurrency::ExecutionFlowGraph::getAlgoStates
AlgsExecutionStates & getAlgoStates(const int &slotNum) const
Definition: ExecutionFlowGraph.h:337
std::vector::push_back
T push_back(T...args)
CommonMessagingBase::error
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Definition: CommonMessaging.h:118
std::ofstream
STL class.
concurrency::ExecutionFlowManager::rootDecisionResolved
bool rootDecisionResolved(const std::vector< int > &node_decisions) const
Check whether root decision was resolved.
Definition: ExecutionFlowManager.cpp:121
concurrency::ExecutionFlowGraph::m_headNode
DecisionNode * m_headNode
the head node of the control flow graph; may want to have multiple ones once supporting trigger paths...
Definition: ExecutionFlowGraph.h:349
concurrency::ExecutionFlowManager::m_EFGraph
ExecutionFlowGraph * m_EFGraph
the control flow graph
Definition: ExecutionFlowManager.h:73
std::stringstream::str
T str(T...args)
std::vector::size
T size(T...args)
std::vector::assign
T assign(T...args)
std::vector< int >
CommonMessagingBase::debug
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
Definition: CommonMessaging.h:127
AlgsExecutionStates::reset
void reset()
Definition: AlgsExecutionStates.h:52
gaudirun.s
string s
Definition: gaudirun.py:245
AthenaScenario.app
tuple app
Definition: AthenaScenario.py:89
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244

void concurrency::ExecutionFlowManager::touchReadyAlgorithms | ( | IGraphVisitor & | visitor | ) | const

Promote all algorithms, ready to be executed, to DataReady state.

Definition at line 127 of file ExecutionFlowManager.cpp.

127 {
128
129 //auto& states = m_EFGraph->getAlgoStates(visitor.m_slotNum);
130 //auto& decisions = m_EFGraph->getNodeDecisions(visitor.m_slotNum);
131
132 //m_EFGraph->m_headNode->promoteToControlReadyState(slotNum,states,decisions);
133
134 m_EFGraph->m_headNode->accept(visitor);
135
136 }
concurrency::DecisionNode::accept
virtual bool accept(IGraphVisitor &visitor)
Definition: ExecutionFlowGraph.cpp:177
concurrency::ExecutionFlowGraph::m_headNode
DecisionNode * m_headNode
the head node of the control flow graph; may want to have multiple ones once supporting trigger paths...
Definition: ExecutionFlowGraph.h:349
concurrency::ExecutionFlowManager::m_EFGraph
ExecutionFlowGraph * m_EFGraph
the control flow graph
Definition: ExecutionFlowManager.h:73

void concurrency::ExecutionFlowManager::updateDecision | ( | const std::string & | algo_name,
|  | const int & | slotNum,
|  | AlgsExecutionStates & | states,
|  | std::vector< int > & | node_decisions
| ) |  | const

Definition at line 101 of file ExecutionFlowManager.cpp.

104 {
105 m_EFGraph->updateDecision(algo_name, slotNum, algo_states, node_decisions);
106 }
concurrency::ExecutionFlowGraph::updateDecision
void updateDecision(const std::string &algo_name, const int &slotNum, AlgsExecutionStates &states, std::vector< int > &node_decisions) const
A method to update algorithm node decision, and propagate it upwards.
Definition: ExecutionFlowGraph.cpp:699
concurrency::ExecutionFlowManager::m_EFGraph
ExecutionFlowGraph * m_EFGraph
the control flow graph
Definition: ExecutionFlowManager.h:73

void concurrency::ExecutionFlowManager::updateEventState | ( | AlgsExecutionStates & | algo_states,
|  | std::vector< int > & | node_decisions
| ) |  | const

Update the state of algorithms to controlready, where possible.

Definition at line 95 of file ExecutionFlowManager.cpp.

96 {
97 m_EFGraph->updateEventState(algo_states, node_decisions);
98 }
concurrency::ExecutionFlowManager::m_EFGraph
ExecutionFlowGraph * m_EFGraph
the control flow graph
Definition: ExecutionFlowManager.h:73
concurrency::ExecutionFlowGraph::updateEventState
void updateEventState(AlgsExecutionStates &states, std::vector< int > &node_decisions) const
XXX CF tests. Is needed for older CF implementation.
Definition: ExecutionFlowGraph.cpp:693

void concurrency::ExecutionFlowManager::updateEventState | ( | AlgsExecutionStates & | algo_states | ) | const

XXX: CF tests.

## Member Data Documentation

ExecutionFlowGraph* concurrency::ExecutionFlowManager::m_EFGraph
| private

the control flow graph

Definition at line 73 of file ExecutionFlowManager.h.

std::string concurrency::ExecutionFlowManager::m_name
| private

Definition at line 71 of file ExecutionFlowManager.h.

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

- GaudiHive/src/ExecutionFlowManager.h
- GaudiHive/src/ExecutionFlowManager.cpp