The Gaudi Framework  v29r0 (ff2e7097)
PrecedenceSvc.h
Go to the documentation of this file.
1 #ifndef GAUDIHIVE_PRECEDENCESVC_H_
2 #define GAUDIHIVE_PRECEDENCESVC_H_
3 
4 #include "IPrecedenceSvc.h"
5 #include "PrecedenceRulesGraph.h"
6 
7 // Framework include files
9 #include "GaudiKernel/Service.h"
10 
11 #include <boost/filesystem.hpp>
12 
21 class PrecedenceSvc : public extends<Service, IPrecedenceSvc>
22 {
23 
24 public:
26  PrecedenceSvc( const std::string& name, ISvcLocator* svc );
27 
29  ~PrecedenceSvc() = default;
30 
32  StatusCode initialize() override;
33 
35  StatusCode finalize() override;
36 
38  StatusCode iterate( EventSlot&, const Cause& ) override;
39 
41  StatusCode simulate( EventSlot& ) const override;
42 
44  bool CFRulesResolved( EventSlot& ) const override;
45 
47  uint getPriority( const std::string& name ) const override
48  {
49  return (int)m_PRGraph.getAlgorithmNode( name )->getRank();
50  }
51 
53  bool isBlocking( const std::string& name ) const override { return m_PRGraph.getAlgorithmNode( name )->isIOBound(); }
54 
56  void dumpControlFlow() const override;
57  void dumpDataFlow() const override;
58  const std::string printState( EventSlot& ) const override;
59 
62  void dumpPrecedenceRules( EventSlot& ) override;
65  void dumpPrecedenceTrace( EventSlot& ) override;
66 
69 
70 private:
71  StatusCode assembleCFRules( Algorithm*, const std::string&, unsigned int recursionDepth = 0 );
72 
73 private:
79  Gaudi::Property<std::string> m_mode{this, "TaskPriorityRule", "", "Task avalanche induction strategy."};
81  Gaudi::Property<bool> m_ignoreDFRules{this, "IgnoreDFRules", false, "Ignore the data flow rules."};
84  boost::filesystem::unique_path( boost::filesystem::path( "precedence.analysis.%%%%" ) )};
85  Gaudi::Property<bool> m_dumpPrecTrace{this, "DumpPrecedenceTrace", false,
86  "Dump task precedence traces for each event."
87  "The service must be in DEBUG mode for this switch "
88  "to have effect."};
90  this, "PrecedenceTraceFile", "", "Override default name of the GRAPHML trace file. NOTE: if more than "
91  "1 event is processed, the setting forces creation of a single file "
92  "with cumulative precedence trace."};
93  Gaudi::Property<bool> m_dumpPrecRules{this, "DumpPrecedenceRules", false, "Dump task precedence rules. The service "
94  "must be in DEBUG mode for this switch "
95  "to have effect."};
96  Gaudi::Property<std::string> m_dumpPrecRulesFile{this, "PrecedenceRulesFile", "",
97  "Override default name of the GRAPHML precedence rules file."};
98 };
99 
100 #endif /* GAUDIHIVE_PRECEDENCESVC_H_ */
const concurrency::PrecedenceRulesGraph * getRules() const
Precedence rules accessor.
Definition: PrecedenceSvc.h:68
Gaudi::Property< bool > m_dumpPrecTrace
Definition: PrecedenceSvc.h:85
concurrency::PrecedenceRulesGraph m_PRGraph
Graph of precedence rules.
Definition: PrecedenceSvc.h:77
void dumpPrecedenceRules(EventSlot &) override
Dump precedence rules (available only in DEBUG mode, and must be enabled with the corresponding servi...
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition: ISvcLocator.h:25
const std::string & name() const override
Retrieve name of the service.
Definition: Service.cpp:289
void dumpDataFlow() const override
Implementation of property with value of concrete type.
Definition: Property.h:319
PrecedenceSvc(const std::string &name, ISvcLocator *svc)
Constructor.
StatusCode assembleCFRules(Algorithm *, const std::string &, unsigned int recursionDepth=0)
A service to resolve the task execution precedence.
Definition: PrecedenceSvc.h:21
~PrecedenceSvc()=default
Destructor.
boost::filesystem::path m_dumpDirName
Precedence analysis facilities.
Definition: PrecedenceSvc.h:83
AlgorithmNode * getAlgorithmNode(const std::string &algoName) const
Get the AlgorithmNode from by algorithm name using graph index.
bool isIOBound() const
Check if algorithm is I/O-bound.
Gaudi::Property< bool > m_ignoreDFRules
Scheduling strategy.
Definition: PrecedenceSvc.h:81
StatusCode iterate(EventSlot &, const Cause &) override
Infer the precedence effect caused by an execution flow event.
STL class.
Gaudi::Property< std::string > m_dumpPrecRulesFile
Definition: PrecedenceSvc.h:96
SmartIF< IAlgResourcePool > m_algResourcePool
A shortcut to the algorithm resource pool.
Definition: PrecedenceSvc.h:75
const float & getRank() const
Get Algorithm rank.
uint getPriority(const std::string &name) const override
Get priority of an algorithm.
Definition: PrecedenceSvc.h:47
StatusCode finalize() override
Finalize.
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:28
Gaudi::Property< std::string > m_mode
Scheduling strategy.
Definition: PrecedenceSvc.h:79
void dumpPrecedenceTrace(EventSlot &) override
Dump precedence trace (available only in DEBUG mode, and must be enabled with the corresponding servi...
bool CFRulesResolved(EventSlot &) const override
Check if the root CF decision is resolved.
StatusCode simulate(EventSlot &) const override
Simulate execution flow.
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:78
Base class used to extend a class implementing other interfaces.
Definition: extends.h:10
Gaudi::Property< bool > m_dumpPrecRules
Definition: PrecedenceSvc.h:93
Class representing the event slot.
Definition: EventSlot.h:11
bool isBlocking(const std::string &name) const override
Check if a task is CPU-blocking.
Definition: PrecedenceSvc.h:53
Gaudi::Property< std::string > m_dumpPrecTraceFile
Definition: PrecedenceSvc.h:89
const std::string printState(EventSlot &) const override
void dumpControlFlow() const override
Dump precedence rules.
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator.
Definition: Service.cpp:292
StatusCode initialize() override
Initialize.