| The Gaudi Framework v32r1 (f65d50dc)

PrecedenceRulesGraph.h
Go to the documentation of this file.
1 #ifndef GAUDIHIVE_PRECEDENCERULESGRAPH_H
2 #define GAUDIHIVE_PRECEDENCERULESGRAPH_H
3
4 // std includes
5 #include <algorithm>
6 #include <memory>
7 #include <sstream>
8 #include <unordered_map>
9 #include <variant>
10 #include <vector>
11
12 #include <boost/filesystem.hpp>
13 #include <boost/graph/adjacency_list.hpp>
14 #include <boost/graph/graphml.hpp>
15
16 // fwk includes
17 #include "../AlgsExecutionStates.h"
18 #include "../EventSlot.h"
19 #include "GaudiKernel/CommonMessaging.h"
20 #include "GaudiKernel/DataObject.h"
21 #include "GaudiKernel/ICondSvc.h"
22 #include "GaudiKernel/IHiveWhiteBoard.h"
23 #include "GaudiKernel/ITimelineSvc.h"
24 #include "GaudiKernel/TaggedBool.h"
25 #include "Visitors/IGraphVisitor.h"
26 #include <Gaudi/Algorithm.h>
27
28 namespace concurrency {
29 using Concurrent = Gaudi::tagged_bool<class Concurrent_tag>;
30 using PromptDecision = Gaudi::tagged_bool<class PromptDecision_tag>;
31 using ModeOr = Gaudi::tagged_bool<class ModeOr_tag>;
32 using AllPass = Gaudi::tagged_bool<class AllPass_tag>;
33 using Inverted = Gaudi::tagged_bool<class Inverted_tag>;
34 } // namespace concurrency
35
36 namespace precedence {
37
38 // Precedence trace utilities ==============================================
39 struct AlgoTraceProps {
40 AlgoTraceProps() {}
41 AlgoTraceProps( const std::string& name, int index, int rank, double runtime )
42 : m_name( name ), m_index( index ), m_rank( rank ), m_runtime( runtime ) {}
43 std::string m_name;
44 int m_index{-1};
45 int m_rank{-1};
46 int m_runtime{-1}; // ns
47 int m_eccentricity{-1};
48 };
49
50 using PrecTrace = boost::adjacency_list<boost::vecS, boost::vecS, boost::bidirectionalS, AlgoTraceProps>;
51 using AlgoTraceVertex = boost::graph_traits<PrecTrace>::vertex_descriptor;
52
53 // Precedence rules utilities ==============================================
54 struct AlgoProps {
55 AlgoProps() {}
56 AlgoProps( Gaudi::Algorithm* algo, uint nodeIndex, uint algoIndex, bool inverted, bool allPass )
57 : m_name( algo->name() )
58 , m_nodeIndex( nodeIndex )
59 , m_algoIndex( algoIndex )
60 , m_algorithm( algo )
61 , m_inverted( inverted )
62 , m_allPass( allPass )
63 , m_isIOBound( algo->isIOBound() ) {}
64
65 std::string m_name{""};
66 int m_nodeIndex{-1};
67 int m_algoIndex{-1};
68 int m_rank{-1};
70 Gaudi::Algorithm* m_algorithm{nullptr};
71
73 bool m_inverted{false};
75 bool m_allPass{false};
77 bool m_isIOBound{false};
78 };
79
80 struct DecisionHubProps {
81 DecisionHubProps( const std::string& name, uint nodeIndex, concurrency::Concurrent modeConcurrent,
82 concurrency::PromptDecision modePromptDecision, concurrency::ModeOr modeOR,
83 concurrency::AllPass allPass, concurrency::Inverted isInverted )
84 : m_name( name )
85 , m_nodeIndex( nodeIndex )
86 , m_modeConcurrent( modeConcurrent )
87 , m_modePromptDecision( modePromptDecision )
88 , m_inverted( isInverted )
89 , m_modeOR( modeOR )
90 , m_allPass( allPass ) {}
91
92 std::string m_name;
93 uint m_nodeIndex;
94
96 bool m_modeConcurrent;
99 bool m_modePromptDecision;
101 bool m_inverted{false};
103 bool m_modeOR;
105 bool m_allPass;
106 };
107
108 struct DataProps {
109 DataProps( const DataObjID& id ) : m_id( id ) {}
110
111 DataObjID m_id;
112 };
113
114 struct CondDataProps : DataProps {
115 CondDataProps( const DataObjID& id ) : DataProps( id ) {}
116 };
117
118 // Vertex unpacking ========================================================
119
120 struct VertexName {
121 std::string operator()( const AlgoProps& props ) const { return props.m_name; }
122
123 std::string operator()( const DecisionHubProps& props ) const { return props.m_name; }
124
125 std::string operator()( const DataProps& props ) const { return props.m_id.fullKey(); }
126 };
127
128 struct GroupMode {
129 std::string operator()( const AlgoProps& ) const { return ""; }
130
131 std::string operator()( const DecisionHubProps& props ) const {
132 return props.m_modeConcurrent ? "Concurrent" : "Sequential";
133 }
134
135 std::string operator()( const DataProps& ) const { return ""; }
136 };
137
138 struct GroupLogic {
139 std::string operator()( const AlgoProps& ) const { return ""; }
140
141 std::string operator()( const DecisionHubProps& props ) const { return props.m_modeOR ? "OR" : "AND"; }
142
143 std::string operator()( const DataProps& ) const { return ""; }
144 };
145
146 struct GroupExit {
147 std::string operator()( const AlgoProps& ) const { return ""; }
148
149 std::string operator()( const DecisionHubProps& props ) const {
150 return props.m_modePromptDecision ? "Early" : "Late";
151 }
152
153 std::string operator()( const DataProps& ) const { return ""; }
154 };
155
156 struct DecisionNegation {
157 std::string operator()( const AlgoProps& props ) const { return props.m_inverted ? "Inverted" : "Non-inverted"; }
158
159 std::string operator()( const DecisionHubProps& ) const { return ""; }
160
161 std::string operator()( const DataProps& ) const { return ""; }
162 };
163
164 struct AllPass {
165 std::string operator()( const AlgoProps& props ) const { return props.m_allPass ? "Optimist" : "Realist"; }
166
167 std::string operator()( const DecisionHubProps& props ) const { return props.m_allPass ? "Optimist" : "Realist"; }
168
169 std::string operator()( const DataProps& ) const { return ""; }
170 };
171
172 struct CFDecision {
173 CFDecision( const EventSlot& slot ) : m_slot( slot ) {}
174
175 std::string operator()( const AlgoProps& props ) const {
176 return std::to_string( m_slot.controlFlowState.at( props.m_nodeIndex ) );
177 }
178
179 std::string operator()( const DecisionHubProps& props ) const {
180 return std::to_string( m_slot.controlFlowState.at( props.m_nodeIndex ) );
181 }
182
183 std::string operator()( const DataProps& ) const { return ""; }
184
185 const EventSlot& m_slot;
186 };
187
188 struct EntityState {
189 EntityState( const EventSlot& slot, SmartIF<ISvcLocator>& svcLocator, bool conditionsEnabled )
190 : m_slot( slot ), m_conditionsEnabled( conditionsEnabled ) {
191 SmartIF<IMessageSvc> msgSvc{svcLocator};
192 MsgStream log{msgSvc, "EntityState.Getter"};
193
194 // Figure if we can discover the data object states
195 m_whiteboard = svcLocator->service<IHiveWhiteBoard>( "EventDataSvc", false );
196 if ( !m_whiteboard.isValid() ) {
197 log << MSG::WARNING << "Failed to locate EventDataSvc: no way to add DO "
198 << "states to the TTT dump " << endmsg;
199 }
200
201 if ( m_conditionsEnabled ) {
202 // Figure if we can discover Condition data object states
203 m_condSvc = svcLocator->service<ICondSvc>( "CondSvc", false );
204 if ( !m_condSvc.isValid() )
205 log << MSG::WARNING << "Failed to locate CondSvc: no way to add Condition DO "
206 << "states to the TTT dump " << endmsg;
207 }
208
209 if ( !m_slot.eventContext->valid() )
210 log << MSG::WARNING << "Event context is invalid: no way to add DO states"
211 << " in the TTT dump" << endmsg;
212 }
213
214 // Returns algorithm's FSM state
215 std::string operator()( const AlgoProps& props ) const {
216 std::ostringstream oss;
217 oss << m_slot.algsStates[props.m_algoIndex];
218 return oss.str();
219 }
220
221 std::string operator()( const DecisionHubProps& ) const { return ""; }
222
223 std::string operator()( const DataProps& props ) const {
224 std::string state;
225
226 if ( m_whiteboard.isValid() && m_slot.eventContext->valid() )
227 if ( m_whiteboard->selectStore( m_slot.eventContext->slot() ).isSuccess() )
228 state = m_whiteboard->exists( props.m_id ) ? "Produced" : "Missing";
229
230 return state;
231 }
232
233 std::string operator()( const CondDataProps& props ) const {
234 std::string state;
235
236 if ( m_condSvc.isValid() && m_slot.eventContext->valid() )
237 state = m_condSvc->isValidID( *( m_slot.eventContext ), props.m_id ) ? "Produced" : "Missing";
238
239 return state;
240 }
241
242 const EventSlot& m_slot;
243
244 SmartIF<IHiveWhiteBoard> m_whiteboard;
245 SmartIF<ICondSvc> m_condSvc;
246 bool m_conditionsEnabled{false};
247 };
248
249 struct StartTime {
250 StartTime( const EventSlot& slot, SmartIF<ISvcLocator>& svcLocator ) : m_slot( slot ) {
251 SmartIF<IMessageSvc> msgSvc{svcLocator};
252 MsgStream log{msgSvc, "StartTime.Getter"};
253
254 // Figure if we can discover the algorithm timings
255 m_timelineSvc = svcLocator->service<ITimelineSvc>( "TimelineSvc", false );
256 if ( !m_timelineSvc.isValid() ) {
257 log << MSG::WARNING << "Failed to locate the TimelineSvc: no way to "
258 << "add algorithm start time to the TTT dumps" << endmsg;
259 }
260 }
261
262 std::string operator()( const AlgoProps& props ) const {
263
264 std::string startTime;
265
266 if ( m_timelineSvc.isValid() ) {
267
268 TimelineEvent te{};
269 te.algorithm = props.m_name;
270 te.slot = m_slot.eventContext->slot();
271 te.event = m_slot.eventContext->evt();
272
273 m_timelineSvc->getTimelineEvent( te );
274 startTime = std::to_string(
275 std::chrono::duration_cast<std::chrono::nanoseconds>( te.start.time_since_epoch() ).count() );
276 }
277
278 return startTime;
279 }
280
281 std::string operator()( const DecisionHubProps& ) const { return ""; }
282
283 std::string operator()( const DataProps& ) const { return ""; }
284
285 const EventSlot& m_slot;
286 SmartIF<ITimelineSvc> m_timelineSvc;
287 };
288
289 struct EndTime {
290 EndTime( const EventSlot& slot, SmartIF<ISvcLocator>& svcLocator ) : m_slot( slot ) {
291 SmartIF<IMessageSvc> msgSvc{svcLocator};
292 MsgStream log{msgSvc, "EndTime.Getter"};
293
294 // Figure if we can discover the algorithm timings
295 m_timelineSvc = svcLocator->service<ITimelineSvc>( "TimelineSvc", false );
296 if ( !m_timelineSvc.isValid() )
297 log << MSG::WARNING << "Failed to locate the TimelineSvc: no way to add "
298 << "algorithm completion time to the TTT dumps" << endmsg;
299 }
300
301 std::string operator()( const AlgoProps& props ) const {
302
303 std::string endTime;
304
305 if ( m_timelineSvc.isValid() ) {
306
307 TimelineEvent te{};
308 te.algorithm = props.m_name;
309 te.slot = m_slot.eventContext->slot();
310 te.event = m_slot.eventContext->evt();
311
312 m_timelineSvc->getTimelineEvent( te );
313 endTime =
314 std::to_string( std::chrono::duration_cast<std::chrono::nanoseconds>( te.end.time_since_epoch() ).count() );
315 }
316
317 return endTime;
318 }
319
320 std::string operator()( const DecisionHubProps& ) const { return ""; }
321
322 std::string operator()( const DataProps& ) const { return ""; }
323
324 const EventSlot& m_slot;
325 SmartIF<ITimelineSvc> m_timelineSvc;
326 };
327
328 struct Duration {
329 Duration( const EventSlot& slot, SmartIF<ISvcLocator>& svcLocator ) : m_slot( slot ) {
330 SmartIF<IMessageSvc> msgSvc{svcLocator};
331 MsgStream log{msgSvc, "Duration.Getter"};
332
333 // Figure if we can discover the algorithm timings
334 m_timelineSvc = svcLocator->service<ITimelineSvc>( "TimelineSvc", false );
335 if ( !m_timelineSvc.isValid() )
336 log << MSG::WARNING << "Failed to locate the TimelineSvc: no way to add "
337 << "algorithm's runtimes to the TTT dumps" << endmsg;
338 }
339
340 std::string operator()( const AlgoProps& props ) const {
341
342 std::string time;
343
344 if ( m_timelineSvc.isValid() ) {
345
346 TimelineEvent te;
347 te.algorithm = props.m_name;
348 te.slot = m_slot.eventContext->slot();
349 te.event = m_slot.eventContext->evt();
350
351 m_timelineSvc->getTimelineEvent( te );
352 time = std::to_string( std::chrono::duration_cast<std::chrono::nanoseconds>( te.end - te.start ).count() );
353 }
354
355 return time;
356 }
357
358 std::string operator()( const DecisionHubProps& ) const { return ""; }
359
360 std::string operator()( const DataProps& ) const { return ""; }
361
362 const EventSlot& m_slot;
363 SmartIF<ITimelineSvc> m_timelineSvc;
364 };
365
366 struct Operations {
367 std::string operator()( const AlgoProps& props ) const { return props.m_isIOBound ? "IO-bound" : "CPU-bound"; }
368
369 std::string operator()( const DecisionHubProps& ) const { return ""; }
370
371 std::string operator()( const DataProps& ) const { return ""; }
372 };
373
374 static inline std::ostream& operator<<( std::ostream& os, const AlgoProps& ) { return os << "Algorithm"; }
375 static inline std::ostream& operator<<( std::ostream& os, const DecisionHubProps& ) { return os << "DecisionHub"; }
376 static inline std::ostream& operator<<( std::ostream& os, const DataProps& ) { return os << "Data"; }
377 static inline std::ostream& operator<<( std::ostream& os, const CondDataProps& ) { return os << "ConditionData"; }
378
379 //=========================================================================
380
381 using VariantVertexProps = std::variant<AlgoProps, DecisionHubProps, DataProps, CondDataProps>;
382 using PRGraph = boost::adjacency_list<boost::vecS, boost::vecS, boost::bidirectionalS, VariantVertexProps>;
383 using PRVertexDesc = boost::graph_traits<PRGraph>::vertex_descriptor;
384
385 } // namespace precedence
386
387 struct Cause final {
388 enum class source { Root, Task };
389
390 source m_source;
391 std::string m_sourceName;
392 };
393
394 namespace concurrency {
395 class PrecedenceRulesGraph;
396
397 using precedence::AlgoProps;
398 using precedence::CondDataProps;
399 using precedence::DataProps;
400 using precedence::DecisionHubProps;
401 using precedence::PRVertexDesc;
402 using precedence::VariantVertexProps;
403
404 // ==========================================================================
405 class ControlFlowNode {
406 public:
408 ControlFlowNode( PrecedenceRulesGraph& graph, unsigned int nodeIndex, const std::string& name )
409 : m_graph( &graph ), m_nodeIndex( nodeIndex ), m_nodeName( name ) {}
411 virtual ~ControlFlowNode() = default;
412
414 virtual bool accept( IGraphVisitor& visitor ) = 0;
416 virtual void printState( std::stringstream& output, EventSlot& slot, const unsigned int& recursionLevel ) const = 0;
418 const unsigned int& getNodeIndex() const { return m_nodeIndex; }
420 const std::string& getNodeName() const { return m_nodeName; }
421
422 public:
423 PrecedenceRulesGraph* m_graph;
424
425 protected:
426 unsigned int m_nodeIndex;
427 std::string m_nodeName;
428 };
429
430 class DecisionNode final : public ControlFlowNode {
431 public:
433 DecisionNode( PrecedenceRulesGraph& graph, unsigned int nodeIndex, const std::string& name,
434 Concurrent modeConcurrent, PromptDecision modePromptDecision, ModeOr modeOR, AllPass allPass,
435 Inverted isInverted )
436 : ControlFlowNode( graph, nodeIndex, name )
437 , m_modeConcurrent( modeConcurrent )
438 , m_modePromptDecision( modePromptDecision )
439 , m_modeOR( modeOR )
440 , m_allPass( allPass )
441 , m_inverted( isInverted ) {}
442
444 bool accept( IGraphVisitor& visitor ) override;
446 void addParentNode( DecisionNode* node );
448 void addDaughterNode( ControlFlowNode* node );
450 const std::vector<ControlFlowNode*>& getDaughters() const { return m_children; }
452 void printState( std::stringstream& output, EventSlot& slot, const unsigned int& recursionLevel ) const override;
453
454 public:
456 bool m_modeConcurrent;
459 bool m_modePromptDecision;
461 bool m_modeOR;
463 bool m_allPass;
465 bool m_inverted{false};
467 std::vector<ControlFlowNode*> m_children;
469 std::vector<DecisionNode*> m_parents;
470 };
471
472 // ==========================================================================
473 class DataNode;
474
475 class AlgorithmNode final : public ControlFlowNode {
476 public:
478 AlgorithmNode( PrecedenceRulesGraph& graph, Gaudi::Algorithm* algoPtr, unsigned int nodeIndex,
479 unsigned int algoIndex, bool inverted, bool allPass )
480 : ControlFlowNode( graph, nodeIndex, algoPtr->name() )
481 , m_algorithm( algoPtr )
482 , m_algoIndex( algoIndex )
483 , m_algoName( algoPtr->name() )
484 , m_inverted( inverted )
485 , m_allPass( allPass )
486 , m_isIOBound( algoPtr->isIOBound() ){};
487
489 bool accept( IGraphVisitor& visitor ) override;
490
492 void addParentNode( DecisionNode* node );
494 const std::vector<DecisionNode*>& getParentDecisionHubs() const { return m_parents; }
495
497 void addOutputDataNode( DataNode* node );
499 void addInputDataNode( DataNode* node );
501 const std::vector<DataNode*>& getOutputDataNodes() const { return m_outputs; }
503 const std::vector<DataNode*>& getInputDataNodes() const { return m_inputs; }
504
506 void setRank( float& rank ) { m_rank = rank; }
508 const float& getRank() const { return m_rank; }
509
511 Gaudi::Algorithm* getAlgorithm() const { return m_algorithm; }
513 const unsigned int& getAlgoIndex() const { return m_algoIndex; }
514
516 void setIOBound( bool value ) { m_isIOBound = value; }
518 bool isIOBound() const { return m_isIOBound; }
519
521 bool isOptimist() const { return m_allPass; };
523 bool isLiar() const { return m_inverted; };
524
526 void printState( std::stringstream& output, EventSlot& slot, const unsigned int& recursionLevel ) const override;
527
528 public:
530 std::vector<DecisionNode*> m_parents;
531
532 private:
534 Gaudi::Algorithm* m_algorithm;
536 unsigned int m_algoIndex;
538 std::string m_algoName;
540 bool m_inverted;
542 bool m_allPass;
544 float m_rank = -1;
546 bool m_isIOBound;
547
549 std::vector<DataNode*> m_outputs;
551 std::vector<DataNode*> m_inputs;
552 };
553
554 // ==========================================================================
555 class DataNode {
556 public:
558 DataNode( PrecedenceRulesGraph& graph, const DataObjID& path ) : m_graph( &graph ), m_data_object_path( path ) {}
559
561 virtual ~DataNode() = default;
562
563 const DataObjID& getPath() { return m_data_object_path; }
564
566 virtual bool accept( IGraphVisitor& visitor ) {
567 return visitor.visitEnter( *this ) ? visitor.visit( *this ) : true;
568 }
570 void addProducerNode( AlgorithmNode* node ) {
571 if ( std::find( m_producers.begin(), m_producers.end(), node ) == m_producers.end() )
572 m_producers.push_back( node );
573 }
575 void addConsumerNode( AlgorithmNode* node ) {
576 if ( std::find( m_consumers.begin(), m_consumers.end(), node ) == m_consumers.end() )
577 m_consumers.push_back( node );
578 }
580 const std::vector<AlgorithmNode*>& getProducers() const { return m_producers; }
582 const std::vector<AlgorithmNode*>& getConsumers() const { return m_consumers; }
583
584 public:
585 PrecedenceRulesGraph* m_graph;
586
587 private:
588 DataObjID m_data_object_path;
589 std::vector<AlgorithmNode*> m_producers;
590 std::vector<AlgorithmNode*> m_consumers;
591 };
592
593 class ConditionNode final : public DataNode {
594 public:
596 ConditionNode( PrecedenceRulesGraph& graph, const DataObjID& path, SmartIF<ICondSvc> condSvc )
597 : DataNode( graph, path ), m_condSvc( condSvc ) {}
598
602 bool accept( IGraphVisitor& visitor ) override {
603 return visitor.visitEnter( *this ) ? visitor.visit( *this ) : true;
604 }
605
606 public:
607 // Service for Conditions handling
608 SmartIF<ICondSvc> m_condSvc;
609 };
610
611 // ==========================================================================
612
613 struct IPrecedenceRulesGraph {
614 virtual ~IPrecedenceRulesGraph() = default;
615 };
616
617 class PrecedenceRulesGraph : public CommonMessaging<IPrecedenceRulesGraph> {
618 public:
620 PrecedenceRulesGraph( const std::string& name, SmartIF<ISvcLocator> svc ) : m_svcLocator( svc ), m_name( name ) {
621 // make sure that CommonMessaging is initialized
622 setUpMessaging();
623 }
624
626 StatusCode initialize();
627
629 void accept( IGraphVisitor& visitor ) const;
630
632 StatusCode addDataNode( const DataObjID& dataPath );
634 DataNode* getDataNode( const DataObjID& dataPath ) const { return m_dataPathToDataNodeMap.at( dataPath ).get(); }
636 void registerIODataObjects( const Gaudi::Algorithm* algo );
638 StatusCode buildDataDependenciesRealm();
639
641 void addHeadNode( const std::string& headName, concurrency::Concurrent, concurrency::PromptDecision,
642 concurrency::ModeOr, concurrency::AllPass, concurrency::Inverted );
644 DecisionNode* getHeadNode() const { return m_headNode; };
646 StatusCode addAlgorithmNode( Gaudi::Algorithm* daughterAlgo, const std::string& parentName, bool inverted,
647 bool allPass );
649 AlgorithmNode* getAlgorithmNode( const std::string& algoName ) const {
650 return m_algoNameToAlgoNodeMap.at( algoName ).get();
651 }
653 StatusCode addDecisionHubNode( Gaudi::Algorithm* daughterAlgo, const std::string& parentName,
654 concurrency::Concurrent, concurrency::PromptDecision, concurrency::ModeOr,
655 concurrency::AllPass, concurrency::Inverted );
657 unsigned int getControlFlowNodeCounter() const { return m_nodeCounter; }
658
660 void rankAlgorithms( IGraphVisitor& ranker ) const;
661
663 const std::string& name() const override { return m_name; }
665 SmartIF<ISvcLocator>& serviceLocator() const override { return m_svcLocator; }
668 void printState( std::stringstream& output, EventSlot& slot, const unsigned int& recursionLevel ) const {
669 if ( slot.parentSlot ) {
670 // Start at sub-slot entry point
671 m_decisionNameToDecisionHubMap.at( slot.entryPoint )->printState( output, slot, recursionLevel );
672 } else {
673 // Start at the head node for whole-event slots
674 m_headNode->printState( output, slot, recursionLevel );
675 }
676 }
677
679 void enableAnalysis() { m_enableAnalysis = true; };
680 PRVertexDesc node( const std::string& ) const;
681
683 std::string dumpDataFlow() const;
685 std::string dumpControlFlow() const;
687 void dumpPrecRules( const boost::filesystem::path&, const EventSlot& slot );
689 void dumpPrecTrace( const boost::filesystem::path& );
691 void addEdgeToPrecTrace( const AlgorithmNode* u, const AlgorithmNode* v );
693 void dumpControlFlow( std::ostringstream&, ControlFlowNode*, const int& ) const;
694
695 private:
697 DecisionNode* m_headNode = nullptr;
699 std::unordered_map<std::string, std::unique_ptr<AlgorithmNode>> m_algoNameToAlgoNodeMap;
701 std::unordered_map<std::string, std::unique_ptr<DecisionNode>> m_decisionNameToDecisionHubMap;
703 std::unordered_map<DataObjID, std::unique_ptr<DataNode>, DataObjID_Hasher> m_dataPathToDataNodeMap;
705 std::unordered_map<std::string, DataObjIDColl> m_algoNameToAlgoInputsMap;
706 std::unordered_map<std::string, DataObjIDColl> m_algoNameToAlgoOutputsMap;
707
709 unsigned int m_nodeCounter = 0;
711 unsigned int m_algoCounter = 0;
712
714 mutable SmartIF<ISvcLocator> m_svcLocator;
715 const std::string m_name;
716
718 precedence::PrecTrace m_precTrace;
719 std::map<std::string, precedence::AlgoTraceVertex> m_prec_trace_map;
720 bool m_enableAnalysis{false};
722 precedence::PRGraph m_PRGraph;
723
725 bool m_conditionsRealmEnabled{false};
726 };
727
728 } // namespace concurrency
729 #endif
concurrency::PrecedenceRulesGraph::m_algoNameToAlgoInputsMap
std::unordered_map< std::string, DataObjIDColl > m_algoNameToAlgoInputsMap
Indexes: maps of algorithm's name to algorithm's inputs/outputs.
Definition: PrecedenceRulesGraph.h:705
plotSpeedupsPyRoot.time
def time
Definition: plotSpeedupsPyRoot.py:152
precedence::DecisionNegation::operator()
std::string operator()(const DecisionHubProps &) const
Definition: PrecedenceRulesGraph.h:159
concurrency::AlgorithmNode::m_outputs
std::vector< DataNode * > m_outputs
Algorithm outputs (DataNodes)
Definition: PrecedenceRulesGraph.h:549
precedence::PRGraph
boost::adjacency_list< boost::vecS, boost::vecS, boost::bidirectionalS, VariantVertexProps > PRGraph
Definition: PrecedenceRulesGraph.h:382
precedence::GroupLogic::operator()
std::string operator()(const DecisionHubProps &props) const
Definition: PrecedenceRulesGraph.h:141
MsgStream
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
precedence::DecisionNegation::operator()
std::string operator()(const DataProps &) const
Definition: PrecedenceRulesGraph.h:161
EventSlot::entryPoint
std::string entryPoint
Event Views bookkeeping (TODO: optimize view bookkeeping)
Definition: EventSlot.h:84
precedence::CFDecision
Definition: PrecedenceRulesGraph.h:172
SmartIF< ISvcLocator >
EventSlot
Class representing an event slot.
Definition: EventSlot.h:14
precedence::GroupMode
Definition: PrecedenceRulesGraph.h:128
Cause::source::Task
Cause::source
source
Definition: PrecedenceRulesGraph.h:388
EventContext::slot
ContextID_t slot() const
Definition: EventContext.h:41
concurrency::DecisionNode::m_parents
std::vector< DecisionNode * > m_parents
Direct parent nodes.
Definition: PrecedenceRulesGraph.h:469
precedence::AlgoTraceProps::AlgoTraceProps
AlgoTraceProps(const std::string &name, int index, int rank, double runtime)
Definition: PrecedenceRulesGraph.h:41
concurrency::DecisionNode
Definition: PrecedenceRulesGraph.h:430
concurrency::ControlFlowNode::ControlFlowNode
ControlFlowNode(PrecedenceRulesGraph &graph, unsigned int nodeIndex, const std::string &name)
Constructor.
Definition: PrecedenceRulesGraph.h:408
precedence::Duration
Definition: PrecedenceRulesGraph.h:328
concurrency::ControlFlowNode::getNodeName
const std::string & getNodeName() const
Get node name.
Definition: PrecedenceRulesGraph.h:420
concurrency::AlgorithmNode::m_algoIndex
unsigned int m_algoIndex
The index of the algorithm.
Definition: PrecedenceRulesGraph.h:536
precedence
Definition: PrecedenceRulesGraph.h:36
precedence::DecisionHubProps::m_inverted
bool m_inverted
Whether the selection result is negated or not.
Definition: PrecedenceRulesGraph.h:101
concurrency::PrecedenceRulesGraph::getAlgorithmNode
AlgorithmNode * getAlgorithmNode(const std::string &algoName) const
Get the AlgorithmNode from by algorithm name using graph index.
Definition: PrecedenceRulesGraph.h:649
precedence::DecisionNegation::operator()
std::string operator()(const AlgoProps &props) const
Definition: PrecedenceRulesGraph.h:157
precedence::EndTime::operator()
std::string operator()(const DataProps &) const
Definition: PrecedenceRulesGraph.h:322
concurrency::PrecedenceRulesGraph::m_precTrace
precedence::PrecTrace m_precTrace
facilities for algorithm precedence tracing
Definition: PrecedenceRulesGraph.h:718
concurrency::AlgorithmNode::AlgorithmNode
AlgorithmNode(PrecedenceRulesGraph &graph, Gaudi::Algorithm *algoPtr, unsigned int nodeIndex, unsigned int algoIndex, bool inverted, bool allPass)
Constructor.
Definition: PrecedenceRulesGraph.h:478
GaudiPython.HistoUtils.path
path
Definition: HistoUtils.py:932
concurrency::AlgorithmNode::setIOBound
void setIOBound(bool value)
Set the I/O-boundness flag.
Definition: PrecedenceRulesGraph.h:516
precedence::CondDataProps::CondDataProps
CondDataProps(const DataObjID &id)
Definition: PrecedenceRulesGraph.h:115
EventContext::evt
ContextEvt_t evt() const
Definition: EventContext.h:40
gaudiComponentHelp.name
name
Definition: gaudiComponentHelp.py:41
concurrency::DecisionNode::addDaughterNode
void addDaughterNode(ControlFlowNode *node)
Add a daughter node.
Definition: PrecedenceRulesGraph.cpp:36
precedence::AlgoTraceVertex
boost::graph_traits< PrecTrace >::vertex_descriptor AlgoTraceVertex
Definition: PrecedenceRulesGraph.h:51
concurrency::PrecedenceRulesGraph::serviceLocator
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator.
Definition: PrecedenceRulesGraph.h:665
concurrency::AlgorithmNode::getParentDecisionHubs
const std::vector< DecisionNode * > & getParentDecisionHubs() const
Get all parent decision hubs.
Definition: PrecedenceRulesGraph.h:494
DataObjID
Definition: DataObjID.h:37
precedence::EndTime::operator()
std::string operator()(const AlgoProps &props) const
Definition: PrecedenceRulesGraph.h:301
concurrency::DataNode
Definition: PrecedenceRulesGraph.h:555
precedence::Duration::operator()
std::string operator()(const AlgoProps &props) const
Definition: PrecedenceRulesGraph.h:340
precedence::PRVertexDesc
boost::graph_traits< PRGraph >::vertex_descriptor PRVertexDesc
Definition: PrecedenceRulesGraph.h:383
precedence::AlgoTraceProps::m_eccentricity
int m_eccentricity
Definition: PrecedenceRulesGraph.h:47
precedence::EntityState::operator()
std::string operator()(const DataProps &props) const
Definition: PrecedenceRulesGraph.h:223
concurrency::AlgorithmNode::m_algoName
std::string m_algoName
The name of the algorithm.
Definition: PrecedenceRulesGraph.h:538
gaudirun.output
output
Definition: gaudirun.py:484
concurrency::PrecedenceRulesGraph::addAlgorithmNode
StatusCode addAlgorithmNode(Gaudi::Algorithm *daughterAlgo, const std::string &parentName, bool inverted, bool allPass)
Add algorithm node.
Definition: PrecedenceRulesGraph.cpp:309
concurrency
Definition: PrecedenceRulesGraph.cpp:27
precedence::GroupExit::operator()
std::string operator()(const DecisionHubProps &props) const
Definition: PrecedenceRulesGraph.h:149
precedence::CFDecision::operator()
std::string operator()(const AlgoProps &props) const
Definition: PrecedenceRulesGraph.h:175
precedence::VertexName::operator()
std::string operator()(const AlgoProps &props) const
Definition: PrecedenceRulesGraph.h:121
precedence::Operations::operator()
std::string operator()(const AlgoProps &props) const
Definition: PrecedenceRulesGraph.h:367
concurrency::IGraphVisitor::visit
virtual bool visit(DecisionNode &)
Definition: IGraphVisitor.h:16
precedence::CFDecision::operator()
std::string operator()(const DecisionHubProps &props) const
Definition: PrecedenceRulesGraph.h:179
concurrency::AlgorithmNode::setRank
void setRank(float &rank)
Set Algorithm rank.
Definition: PrecedenceRulesGraph.h:506
concurrency::DecisionNode::m_children
std::vector< ControlFlowNode * > m_children
All direct daughter nodes in the tree.
Definition: PrecedenceRulesGraph.h:467
precedence::AlgoProps
Definition: PrecedenceRulesGraph.h:54
concurrency::IGraphVisitor::visitEnter
virtual bool visitEnter(DecisionNode &) const
Definition: IGraphVisitor.h:15
concurrency::AlgorithmNode::getAlgorithm
Gaudi::Algorithm * getAlgorithm() const
get Algorithm representatives
Definition: PrecedenceRulesGraph.h:511
concurrency::PrecedenceRulesGraph::dumpPrecRules
void dumpPrecRules(const boost::filesystem::path &, const EventSlot &slot)
dump to file the precedence rules
Definition: PrecedenceRulesGraph.cpp:561
precedence::EntityState::EntityState
EntityState(const EventSlot &slot, SmartIF< ISvcLocator > &svcLocator, bool conditionsEnabled)
Definition: PrecedenceRulesGraph.h:189
precedence::EntityState::operator()
std::string operator()(const CondDataProps &props) const
Definition: PrecedenceRulesGraph.h:233
std::to_string
T to_string(T... args)
precedence::DataProps::DataProps
DataProps(const DataObjID &id)
Definition: PrecedenceRulesGraph.h:109
SmartIF::isValid
bool isValid() const
Allow for check if smart pointer is valid.
Definition: SmartIF.h:62
precedence::VertexName::operator()
std::string operator()(const DecisionHubProps &props) const
Definition: PrecedenceRulesGraph.h:123
concurrency::PrecedenceRulesGraph::m_prec_trace_map
std::map< std::string, precedence::AlgoTraceVertex > m_prec_trace_map
Definition: PrecedenceRulesGraph.h:719
concurrency::AlgorithmNode::m_parents
std::vector< DecisionNode * > m_parents
Control flow parents of an AlgorithmNode (DecisionNodes)
Definition: PrecedenceRulesGraph.h:530
precedence::Duration::operator()
std::string operator()(const DecisionHubProps &) const
Definition: PrecedenceRulesGraph.h:358
concurrency::ControlFlowNode
Definition: PrecedenceRulesGraph.h:405
ITimelineSvc::getTimelineEvent
virtual bool getTimelineEvent(TimelineEvent &) const =0
precedence::AlgoProps::m_isIOBound
bool m_isIOBound
If an algorithm is blocking.
Definition: PrecedenceRulesGraph.h:77
precedence::EndTime::m_timelineSvc
SmartIF< ITimelineSvc > m_timelineSvc
Definition: PrecedenceRulesGraph.h:325
precedence::CFDecision::m_slot
const EventSlot & m_slot
Definition: PrecedenceRulesGraph.h:185
TimelineEvent::algorithm
std::string algorithm
Definition: ITimelineSvc.h:21
precedence::AlgoTraceProps
Definition: PrecedenceRulesGraph.h:39
EventSlot::controlFlowState
std::vector< int > controlFlowState
State of the control flow.
Definition: EventSlot.h:77
precedence::AlgoProps::m_algoIndex
int m_algoIndex
Definition: PrecedenceRulesGraph.h:67
concurrency::PrecedenceRulesGraph::m_algoCounter
unsigned int m_algoCounter
Total number of algorithm nodes in the graph.
Definition: PrecedenceRulesGraph.h:711
precedence::DecisionHubProps::m_allPass
bool m_allPass
Whether always passing regardless of daughter results.
Definition: PrecedenceRulesGraph.h:105
Cause::m_source
source m_source
Definition: PrecedenceRulesGraph.h:390
concurrency::ControlFlowNode::accept
virtual bool accept(IGraphVisitor &visitor)=0
Visitor entry point.
IHiveWhiteBoard::exists
virtual bool exists(const DataObjID &)=0
Check if a data object exists in store.
precedence::GroupLogic::operator()
std::string operator()(const DataProps &) const
Definition: PrecedenceRulesGraph.h:143
concurrency::PrecedenceRulesGraph::addDataNode
StatusCode addDataNode(const DataObjID &dataPath)
Add DataNode that represents DataObject.
Definition: PrecedenceRulesGraph.cpp:362
concurrency::AlgorithmNode::m_inverted
bool m_inverted
Whether the selection result is negated or not.
Definition: PrecedenceRulesGraph.h:540
concurrency::DecisionNode::m_allPass
bool m_allPass
Whether always passing regardless of daughter results.
Definition: PrecedenceRulesGraph.h:463
precedence::AllPass::operator()
std::string operator()(const AlgoProps &props) const
Definition: PrecedenceRulesGraph.h:165
TimelineEvent
Definition: ITimelineSvc.h:13
std::map< std::string, precedence::AlgoTraceVertex >
EventContext::valid
bool valid() const
Definition: EventContext.h:44
precedence::EntityState::operator()
std::string operator()(const AlgoProps &props) const
Definition: PrecedenceRulesGraph.h:215
precedence::StartTime::operator()
std::string operator()(const AlgoProps &props) const
Definition: PrecedenceRulesGraph.h:262
concurrency::PrecedenceRulesGraph::m_dataPathToDataNodeMap
std::unordered_map< DataObjID, std::unique_ptr< DataNode >, DataObjID_Hasher > m_dataPathToDataNodeMap
Index: map of data path to DataNode.
Definition: PrecedenceRulesGraph.h:703
std::stringstream
STL class.
DataObjID::fullKey
std::string fullKey() const
Definition: DataObjID.cpp:88
concurrency::IPrecedenceRulesGraph::~IPrecedenceRulesGraph
virtual ~IPrecedenceRulesGraph()=default
concurrency::AlgorithmNode::isOptimist
bool isOptimist() const
Check if positive control flow decision is enforced.
Definition: PrecedenceRulesGraph.h:521
concurrency::ModeOr
Gaudi::tagged_bool< class ModeOr_tag > ModeOr
Definition: PrecedenceRulesGraph.h:31
CommonMessaging< IPrecedenceRulesGraph >::setUpMessaging
MSG::Level setUpMessaging() const
Set up local caches.
Definition: CommonMessaging.h:169
concurrency::DataNode::getConsumers
const std::vector< AlgorithmNode * > & getConsumers() const
Get all data object consumers.
Definition: PrecedenceRulesGraph.h:582
AvalancheSchedulerErrorTest.msgSvc
msgSvc
Definition: AvalancheSchedulerErrorTest.py:67
precedence::StartTime::m_timelineSvc
SmartIF< ITimelineSvc > m_timelineSvc
Definition: PrecedenceRulesGraph.h:286
concurrency::AlgorithmNode::m_algorithm
Gaudi::Algorithm * m_algorithm
Algorithm representative behind the AlgorithmNode.
Definition: PrecedenceRulesGraph.h:534
precedence::AllPass::operator()
std::string operator()(const DataProps &) const
Definition: PrecedenceRulesGraph.h:169
std::string
STL class.
precedence::AlgoTraceProps::AlgoTraceProps
AlgoTraceProps()
Definition: PrecedenceRulesGraph.h:40
precedence::DataProps::m_id
DataObjID m_id
Definition: PrecedenceRulesGraph.h:111
concurrency::AlgorithmNode::getAlgoIndex
const unsigned int & getAlgoIndex() const
Get algorithm index.
Definition: PrecedenceRulesGraph.h:513
concurrency::DecisionNode::m_modeOR
bool m_modeOR
Whether acting as "and" (false) or "or" node (true)
Definition: PrecedenceRulesGraph.h:461
std::vector::at
T at(T... args)
precedence::GroupMode::operator()
std::string operator()(const DecisionHubProps &props) const
Definition: PrecedenceRulesGraph.h:131
TimelineEvent::end
time_point end
Definition: ITimelineSvc.h:24
precedence::AlgoProps::m_name
std::string m_name
Definition: PrecedenceRulesGraph.h:65
ISvcLocator::service
StatusCode service(const Gaudi::Utils::TypeNameString &name, T *&svc, bool createIf=true)
Templated method to access a service by name.
Definition: ISvcLocator.h:76
concurrency::AlgorithmNode::addInputDataNode
void addInputDataNode(DataNode *node)
Associate an AlgorithmNode, which is a data consumer of this one.
Definition: PrecedenceRulesGraph.cpp:193
concurrency::DecisionNode::accept
bool accept(IGraphVisitor &visitor) override
Visitor entry point.
Definition: PrecedenceRulesGraph.cpp:54
concurrency::PrecedenceRulesGraph::initialize
StatusCode initialize()
Initialize graph.
Definition: PrecedenceRulesGraph.cpp:199
concurrency::PrecedenceRulesGraph::m_algoNameToAlgoNodeMap
std::unordered_map< std::string, std::unique_ptr< AlgorithmNode > > m_algoNameToAlgoNodeMap
Index: map of algorithm's name to AlgorithmNode.
Definition: PrecedenceRulesGraph.h:699
concurrency::DataNode::getProducers
const std::vector< AlgorithmNode * > & getProducers() const
Get all data object producers.
Definition: PrecedenceRulesGraph.h:580
precedence::Duration::m_timelineSvc
SmartIF< ITimelineSvc > m_timelineSvc
Definition: PrecedenceRulesGraph.h:363
concurrency::PrecedenceRulesGraph::dumpPrecTrace
void dumpPrecTrace(const boost::filesystem::path &)
dump to file the precedence trace
Definition: PrecedenceRulesGraph.cpp:602
precedence::Duration::Duration
Duration(const EventSlot &slot, SmartIF< ISvcLocator > &svcLocator)
Definition: PrecedenceRulesGraph.h:329
concurrency::PrecedenceRulesGraph::m_conditionsRealmEnabled
bool m_conditionsRealmEnabled
Enable conditions realm of precedence rules.
Definition: PrecedenceRulesGraph.h:725
precedence::AllPass::operator()
std::string operator()(const DecisionHubProps &props) const
Definition: PrecedenceRulesGraph.h:167
IHiveWhiteBoard::selectStore
virtual StatusCode selectStore(size_t partitionIndex)=0
Activate an given 'slot' for all subsequent calls within the same thread id.
precedence::GroupExit
Definition: PrecedenceRulesGraph.h:146
precedence::GroupLogic::operator()
std::string operator()(const AlgoProps &) const
Definition: PrecedenceRulesGraph.h:139
concurrency::PrecedenceRulesGraph::m_PRGraph
precedence::PRGraph m_PRGraph
BGL-based graph of precedence rules.
Definition: PrecedenceRulesGraph.h:722
precedence::EntityState::m_slot
const EventSlot & m_slot
Definition: PrecedenceRulesGraph.h:242
concurrency::AlgorithmNode::isIOBound
bool isIOBound() const
Check if algorithm is I/O-bound.
Definition: PrecedenceRulesGraph.h:518
concurrency::PrecedenceRulesGraph::printState
void printState(std::stringstream &output, EventSlot &slot, const unsigned int &recursionLevel) const
Print a string representing the control flow state.
Definition: PrecedenceRulesGraph.h:668
Gaudi::svcLocator
GAUDI_API ISvcLocator * svcLocator()
concurrency::ControlFlowNode::m_graph
PrecedenceRulesGraph * m_graph
Definition: PrecedenceRulesGraph.h:423
Cause
Definition: PrecedenceRulesGraph.h:387
Algorithm.h
concurrency::Inverted
Gaudi::tagged_bool< class Inverted_tag > Inverted
Definition: PrecedenceRulesGraph.h:33
concurrency::PrecedenceRulesGraph::enableAnalysis
void enableAnalysis()
BGL-based facilities.
Definition: PrecedenceRulesGraph.h:679
concurrency::DataNode::getPath
const DataObjID & getPath()
Definition: PrecedenceRulesGraph.h:563
concurrency::PrecedenceRulesGraph::m_headNode
DecisionNode * m_headNode
the head node of the control flow graph
Definition: PrecedenceRulesGraph.h:697
precedence::GroupMode::operator()
std::string operator()(const DataProps &) const
Definition: PrecedenceRulesGraph.h:135
concurrency::ControlFlowNode::m_nodeIndex
unsigned int m_nodeIndex
Definition: PrecedenceRulesGraph.h:426
concurrency::DataNode::m_consumers
std::vector< AlgorithmNode * > m_consumers
Definition: PrecedenceRulesGraph.h:590
precedence::EntityState::m_condSvc
SmartIF< ICondSvc > m_condSvc
Definition: PrecedenceRulesGraph.h:245
concurrency::DecisionNode::DecisionNode
DecisionNode(PrecedenceRulesGraph &graph, unsigned int nodeIndex, const std::string &name, Concurrent modeConcurrent, PromptDecision modePromptDecision, ModeOr modeOR, AllPass allPass, Inverted isInverted)
Constructor.
Definition: PrecedenceRulesGraph.h:433
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
concurrency::PrecedenceRulesGraph::dumpControlFlow
std::string dumpControlFlow() const
Print out control flow of Algorithms and Sequences.
Definition: PrecedenceRulesGraph.cpp:501
concurrency::DataNode::accept
virtual bool accept(IGraphVisitor &visitor)
Entry point for a visitor.
Definition: PrecedenceRulesGraph.h:566
concurrency::PrecedenceRulesGraph::m_name
const std::string m_name
Definition: PrecedenceRulesGraph.h:715
ICondSvc::isValidID
virtual bool isValidID(const EventContext &ctx, const DataObjID &id) const =0
check to see if a specific condition object ID is valid for this event
std::ostringstream
STL class.
precedence::EndTime::operator()
std::string operator()(const DecisionHubProps &) const
Definition: PrecedenceRulesGraph.h:320
ITimelineSvc.h
precedence::Operations::operator()
std::string operator()(const DecisionHubProps &) const
Definition: PrecedenceRulesGraph.h:369
CommonMessaging.h
precedence::Duration::m_slot
const EventSlot & m_slot
Definition: PrecedenceRulesGraph.h:362
precedence::PrecTrace
boost::adjacency_list< boost::vecS, boost::vecS, boost::bidirectionalS, AlgoTraceProps > PrecTrace
Definition: PrecedenceRulesGraph.h:50
compareRootHistos.state
def state
Definition: compareRootHistos.py:455
precedence::EndTime
Definition: PrecedenceRulesGraph.h:289
std::ostringstream::str
T str(T... args)
precedence::EndTime::EndTime
EndTime(const EventSlot &slot, SmartIF< ISvcLocator > &svcLocator)
Definition: PrecedenceRulesGraph.h:290
concurrency::AlgorithmNode::getRank
const float & getRank() const
Get Algorithm rank.
Definition: PrecedenceRulesGraph.h:508
TaggedBool.h
Cause::source::Root
concurrency::IGraphVisitor
Definition: IGraphVisitor.h:11
concurrency::DataNode::DataNode
DataNode(PrecedenceRulesGraph &graph, const DataObjID &path)
Constructor.
Definition: PrecedenceRulesGraph.h:558
concurrency::PrecedenceRulesGraph::getControlFlowNodeCounter
unsigned int getControlFlowNodeCounter() const
Get total number of control flow graph nodes.
Definition: PrecedenceRulesGraph.h:657
precedence::DecisionHubProps::m_modePromptDecision
bool m_modePromptDecision
Whether to evaluate the hub decision ASA its child decisions allow to do that.
Definition: PrecedenceRulesGraph.h:99
concurrency::PrecedenceRulesGraph::registerIODataObjects
void registerIODataObjects(const Gaudi::Algorithm *algo)
Register algorithm in the Data Dependency index.
Definition: PrecedenceRulesGraph.cpp:242
precedence::AlgoProps::m_nodeIndex
int m_nodeIndex
Definition: PrecedenceRulesGraph.h:66
ICondSvc
Interface for the Condition Service.
Definition: ICondSvc.h:28
concurrency::PrecedenceRulesGraph::m_algoNameToAlgoOutputsMap
std::unordered_map< std::string, DataObjIDColl > m_algoNameToAlgoOutputsMap
Definition: PrecedenceRulesGraph.h:706
precedence::AlgoProps::m_allPass
bool m_allPass
Whether the selection result is relevant or always "pass".
Definition: PrecedenceRulesGraph.h:75
ITimelineSvc
Definition: ITimelineSvc.h:27
precedence::VertexName
Definition: PrecedenceRulesGraph.h:120
precedence::AlgoProps::m_inverted
bool m_inverted
Whether the selection result is negated or not.
Definition: PrecedenceRulesGraph.h:73
IHiveWhiteBoard
Definition: IHiveWhiteBoard.h:17
precedence::VertexName::operator()
std::string operator()(const DataProps &props) const
Definition: PrecedenceRulesGraph.h:125
concurrency::PrecedenceRulesGraph::PrecedenceRulesGraph
PrecedenceRulesGraph(const std::string &name, SmartIF< ISvcLocator > svc)
Constructor.
Definition: PrecedenceRulesGraph.h:620
precedence::EntityState::m_conditionsEnabled
bool m_conditionsEnabled
Definition: PrecedenceRulesGraph.h:246
concurrency::DecisionNode::getDaughters
const std::vector< ControlFlowNode * > & getDaughters() const
Get children nodes.
Definition: PrecedenceRulesGraph.h:450
DataObjID_Hasher
Definition: DataObjID.h:98
concurrency::Concurrent
Gaudi::tagged_bool< class Concurrent_tag > Concurrent
Definition: PrecedenceRulesGraph.h:29
concurrency::DecisionNode::m_modePromptDecision
bool m_modePromptDecision
Whether to evaluate the hub decision ASA its child decisions allow to do that.
Definition: PrecedenceRulesGraph.h:459
concurrency::DataNode::m_data_object_path
DataObjID m_data_object_path
Definition: PrecedenceRulesGraph.h:588
TimelineEvent::start
time_point start
Definition: ITimelineSvc.h:23
concurrency::PrecedenceRulesGraph::node
PRVertexDesc node(const std::string &) const
Definition: PrecedenceRulesGraph.cpp:470
precedence::EntityState
Definition: PrecedenceRulesGraph.h:188
concurrency::PrecedenceRulesGraph::addEdgeToPrecTrace
void addEdgeToPrecTrace(const AlgorithmNode *u, const AlgorithmNode *v)
set cause-effect connection between two algorithms in the precedence trace
Definition: PrecedenceRulesGraph.cpp:635
concurrency::ControlFlowNode::m_nodeName
std::string m_nodeName
Definition: PrecedenceRulesGraph.h:427
concurrency::AlgorithmNode::m_rank
float m_rank
Algorithm rank of any kind.
Definition: PrecedenceRulesGraph.h:544
plotSpeedupsPyRoot.graph
graph
Definition: plotSpeedupsPyRoot.py:140
precedence::Operations::operator()
std::string operator()(const DataProps &) const
Definition: PrecedenceRulesGraph.h:371
precedence::StartTime
Definition: PrecedenceRulesGraph.h:249
concurrency::PrecedenceRulesGraph
Definition: PrecedenceRulesGraph.h:617
concurrency::ControlFlowNode::~ControlFlowNode
virtual ~ControlFlowNode()=default
Destructor.
concurrency::AlgorithmNode::addOutputDataNode
void addOutputDataNode(DataNode *node)
Associate an AlgorithmNode, which is a data supplier for this one.
Definition: PrecedenceRulesGraph.cpp:187
precedence::AlgoProps::m_algorithm
Gaudi::Algorithm * m_algorithm
Algorithm representative behind the AlgorithmNode.
Definition: PrecedenceRulesGraph.h:70
std::find
T find(T... args)
concurrency::PrecedenceRulesGraph::m_decisionNameToDecisionHubMap
std::unordered_map< std::string, std::unique_ptr< DecisionNode > > m_decisionNameToDecisionHubMap
Index: map of decision's name to DecisionHub.
Definition: PrecedenceRulesGraph.h:701
precedence::CFDecision::operator()
std::string operator()(const DataProps &) const
Definition: PrecedenceRulesGraph.h:183
std::vector
STL class.
concurrency::PrecedenceRulesGraph::addDecisionHubNode
StatusCode addDecisionHubNode(Gaudi::Algorithm *daughterAlgo, const std::string &parentName, concurrency::Concurrent, concurrency::PromptDecision, concurrency::ModeOr, concurrency::AllPass, concurrency::Inverted)
Add a node, which aggregates decisions of direct daughter nodes.
Definition: PrecedenceRulesGraph.cpp:392
precedence::DecisionNegation
Definition: PrecedenceRulesGraph.h:156
concurrency::PrecedenceRulesGraph::accept
void accept(IGraphVisitor &visitor) const
An entry point to visit all graph nodes.
Definition: PrecedenceRulesGraph.cpp:479
precedence::EntityState::m_whiteboard
SmartIF< IHiveWhiteBoard > m_whiteboard
Definition: PrecedenceRulesGraph.h:244
precedence::EntityState::operator()
std::string operator()(const DecisionHubProps &) const
Definition: PrecedenceRulesGraph.h:221
concurrency::PromptDecision
Gaudi::tagged_bool< class PromptDecision_tag > PromptDecision
Definition: PrecedenceRulesGraph.h:30
concurrency::AlgorithmNode::m_inputs
std::vector< DataNode * > m_inputs
Algorithm inputs (DataNodes)
Definition: PrecedenceRulesGraph.h:551
concurrency::DecisionNode::addParentNode
void addParentNode(DecisionNode *node)
Add a parent node.
Definition: PrecedenceRulesGraph.cpp:30
IHiveWhiteBoard.h
concurrency::DecisionNode::m_modeConcurrent
bool m_modeConcurrent
Whether all daughters will be evaluated concurrently or sequentially.
Definition: PrecedenceRulesGraph.h:456
concurrency::AlgorithmNode::getInputDataNodes
const std::vector< DataNode * > & getInputDataNodes() const
Get all consumer nodes.
Definition: PrecedenceRulesGraph.h:503
precedence::AlgoProps::AlgoProps
AlgoProps(Gaudi::Algorithm *algo, uint nodeIndex, uint algoIndex, bool inverted, bool allPass)
Definition: PrecedenceRulesGraph.h:56
concurrency::PrecedenceRulesGraph::getHeadNode
DecisionNode * getHeadNode() const
Get head node.
Definition: PrecedenceRulesGraph.h:644
precedence::CondDataProps
Definition: PrecedenceRulesGraph.h:114
precedence::Operations
Definition: PrecedenceRulesGraph.h:366
concurrency::PrecedenceRulesGraph::name
const std::string & name() const override
Retrieve name of the service.
Definition: PrecedenceRulesGraph.h:663
precedence::GroupExit::operator()
std::string operator()(const AlgoProps &) const
Definition: PrecedenceRulesGraph.h:147
concurrency::DataNode::m_producers
std::vector< AlgorithmNode * > m_producers
Definition: PrecedenceRulesGraph.h:589
concurrency::DataNode::~DataNode
virtual ~DataNode()=default
Destructor.
concurrency::ConditionNode
Definition: PrecedenceRulesGraph.h:593
concurrency::PrecedenceRulesGraph::m_nodeCounter
unsigned int m_nodeCounter
Total number of nodes in the graph.
Definition: PrecedenceRulesGraph.h:709
concurrency::AlgorithmNode::getOutputDataNodes
const std::vector< DataNode * > & getOutputDataNodes() const
Get all supplier nodes.
Definition: PrecedenceRulesGraph.h:501
Gaudi::Algorithm
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:79
precedence::AlgoTraceProps::m_name
std::string m_name
Definition: PrecedenceRulesGraph.h:43
precedence::GroupMode::operator()
std::string operator()(const AlgoProps &) const
Definition: PrecedenceRulesGraph.h:129
concurrency::DecisionNode::printState
void printState(std::stringstream &output, EventSlot &slot, const unsigned int &recursionLevel) const override
Print a string representing the control flow state.
Definition: PrecedenceRulesGraph.cpp:42
concurrency::PrecedenceRulesGraph::getDataNode
DataNode * getDataNode(const DataObjID &dataPath) const
Get DataNode by DataObject path using graph index.
Definition: PrecedenceRulesGraph.h:634
concurrency::AllPass
Gaudi::tagged_bool< class AllPass_tag > AllPass
Definition: PrecedenceRulesGraph.h:32
concurrency::IPrecedenceRulesGraph
Definition: PrecedenceRulesGraph.h:613
CommonMessaging
Definition: CommonMessaging.h:56
EventSlot::parentSlot
EventSlot * parentSlot
Pointer to parent slot (null for top level)
Definition: EventSlot.h:86
precedence::AlgoProps::m_rank
int m_rank
Definition: PrecedenceRulesGraph.h:68
precedence::AlgoTraceProps::m_rank
int m_rank
Definition: PrecedenceRulesGraph.h:45
concurrency::AlgorithmNode
Definition: PrecedenceRulesGraph.h:475
concurrency::AlgorithmNode::addParentNode
void addParentNode(DecisionNode *node)
Add a parent node.
Definition: PrecedenceRulesGraph.cpp:181
concurrency::DecisionNode::m_inverted
bool m_inverted
Whether the selection result is negated or not.
Definition: PrecedenceRulesGraph.h:465
IGraphVisitor.h
TimelineEvent::event
size_t event
Definition: ITimelineSvc.h:19
precedence::DecisionHubProps::DecisionHubProps
DecisionHubProps(const std::string &name, uint nodeIndex, concurrency::Concurrent modeConcurrent, concurrency::PromptDecision modePromptDecision, concurrency::ModeOr modeOR, concurrency::AllPass allPass, concurrency::Inverted isInverted)
Definition: PrecedenceRulesGraph.h:81
precedence::AlgoTraceProps::m_runtime
int m_runtime
Definition: PrecedenceRulesGraph.h:46
precedence::StartTime::operator()
std::string operator()(const DecisionHubProps &) const
Definition: PrecedenceRulesGraph.h:281
concurrency::AlgorithmNode::accept
bool accept(IGraphVisitor &visitor) override
Visitor entry point.
Definition: PrecedenceRulesGraph.cpp:170
TimelineEvent::slot
size_t slot
Definition: ITimelineSvc.h:18
precedence::GroupLogic
Definition: PrecedenceRulesGraph.h:138
concurrency::PrecedenceRulesGraph::dumpDataFlow
std::string dumpDataFlow() const
Print out all data origins and destinations, as reflected in the EF graph.
Definition: PrecedenceRulesGraph.cpp:534
concurrency::DataNode::m_graph
PrecedenceRulesGraph * m_graph
Definition: PrecedenceRulesGraph.h:585
concurrency::AlgorithmNode::isLiar
bool isLiar() const
Check if control flow logic is always inverted.
Definition: PrecedenceRulesGraph.h:523
precedence::StartTime::operator()
std::string operator()(const DataProps &) const
Definition: PrecedenceRulesGraph.h:283
precedence::DecisionHubProps::m_modeOR
bool m_modeOR
Whether acting as "and" (false) or "or" node (true)
Definition: PrecedenceRulesGraph.h:103
MSG::WARNING
Definition: IMessageSvc.h:15
precedence::GroupExit::operator()
std::string operator()(const DataProps &) const
Definition: PrecedenceRulesGraph.h:153
precedence::AlgoProps::AlgoProps
AlgoProps()
Definition: PrecedenceRulesGraph.h:55
precedence::Duration::operator()
std::string operator()(const DataProps &) const
Definition: PrecedenceRulesGraph.h:360
precedence::DecisionHubProps::m_modeConcurrent
bool m_modeConcurrent
Whether all daughters will be evaluated concurrently or sequentially.
Definition: PrecedenceRulesGraph.h:96
precedence::StartTime::m_slot
const EventSlot & m_slot
Definition: PrecedenceRulesGraph.h:285
concurrency::ControlFlowNode::getNodeIndex
const unsigned int & getNodeIndex() const
Get node index.
Definition: PrecedenceRulesGraph.h:418
concurrency::PrecedenceRulesGraph::buildDataDependenciesRealm
StatusCode buildDataDependenciesRealm()
Build data dependency realm WITH data object nodes participating.
Definition: PrecedenceRulesGraph.cpp:261
precedence::AllPass
Definition: PrecedenceRulesGraph.h:164
precedence::DecisionHubProps
Definition: PrecedenceRulesGraph.h:80
concurrency::AlgorithmNode::printState
void printState(std::stringstream &output, EventSlot &slot, const unsigned int &recursionLevel) const override
Print a string representing the control flow state.
Definition: PrecedenceRulesGraph.cpp:66
ICondSvc.h
precedence::EndTime::m_slot
const EventSlot & m_slot
Definition: PrecedenceRulesGraph.h:324
std::ostream
STL class.
concurrency::ConditionNode::accept
bool accept(IGraphVisitor &visitor) override
Need to hide the (identical) base method with this one so that visitEnter(ConditionNode&) and visit(C...
Definition: PrecedenceRulesGraph.h:602
concurrency::AlgorithmNode::m_isIOBound
bool m_isIOBound
If an algorithm is blocking.
Definition: PrecedenceRulesGraph.h:546
precedence::StartTime::StartTime
StartTime(const EventSlot &slot, SmartIF< ISvcLocator > &svcLocator)
Definition: PrecedenceRulesGraph.h:250
concurrency::ControlFlowNode::printState
virtual void printState(std::stringstream &output, EventSlot &slot, const unsigned int &recursionLevel) const =0
Print a string representing the control flow state.
precedence::VariantVertexProps
std::variant< AlgoProps, DecisionHubProps, DataProps, CondDataProps > VariantVertexProps
Definition: PrecedenceRulesGraph.h:381
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:192
concurrency::PrecedenceRulesGraph::m_enableAnalysis
bool m_enableAnalysis
Definition: PrecedenceRulesGraph.h:720
EventSlot::eventContext
std::unique_ptr< EventContext > eventContext
Cache for the eventContext.
Definition: EventSlot.h:73
Cause::m_sourceName
std::string m_sourceName
Definition: PrecedenceRulesGraph.h:391
concurrency::AlgorithmNode::m_allPass
bool m_allPass
Whether the selection result is relevant or always "pass".
Definition: PrecedenceRulesGraph.h:542
precedence::AlgoTraceProps::m_index
int m_index
Definition: PrecedenceRulesGraph.h:44
concurrency::DataNode::addProducerNode
void addProducerNode(AlgorithmNode *node)
Add relationship to producer AlgorithmNode.
Definition: PrecedenceRulesGraph.h:570
concurrency::PrecedenceRulesGraph::addHeadNode
void addHeadNode(const std::string &headName, concurrency::Concurrent, concurrency::PromptDecision, concurrency::ModeOr, concurrency::AllPass, concurrency::Inverted)
Add a node, which has no parents.
Definition: PrecedenceRulesGraph.cpp:445
EventSlot::algsStates
AlgsExecutionStates algsStates
Vector of algorithms states.
Definition: EventSlot.h:75
DataObject.h
GaudiAlg::operator<<
std::ostream & operator<<(std::ostream &str, const GaudiAlg::ID &id)
Operator overloading for ostream.
Definition: GaudiHistoID.h:132
Gaudi.Configuration.log
log
Definition: Configuration.py:13
precedence::DataProps
Definition: PrecedenceRulesGraph.h:108
concurrency::ConditionNode::m_condSvc
SmartIF< ICondSvc > m_condSvc
Definition: PrecedenceRulesGraph.h:608
precedence::DecisionHubProps::m_nodeIndex
uint m_nodeIndex
Definition: PrecedenceRulesGraph.h:93
concurrency::PrecedenceRulesGraph::m_svcLocator
SmartIF< ISvcLocator > m_svcLocator
Service locator (needed to access the MessageSvc)
Definition: PrecedenceRulesGraph.h:714
concurrency::ConditionNode::ConditionNode
ConditionNode(PrecedenceRulesGraph &graph, const DataObjID &path, SmartIF< ICondSvc > condSvc)
Constructor.
Definition: PrecedenceRulesGraph.h:596
concurrency::PrecedenceRulesGraph::rankAlgorithms
void rankAlgorithms(IGraphVisitor &ranker) const
Rank Algorithm nodes by the number of data outputs.
Definition: PrecedenceRulesGraph.cpp:491
std::unordered_map
STL class.
precedence::DecisionHubProps::m_name
std::string m_name
Definition: PrecedenceRulesGraph.h:92
precedence::CFDecision::CFDecision
CFDecision(const EventSlot &slot)
Definition: PrecedenceRulesGraph.h:173
concurrency::DataNode::addConsumerNode
void addConsumerNode(AlgorithmNode *node)
Add relationship to consumer AlgorithmNode.
Definition: PrecedenceRulesGraph.h:575