The Gaudi Framework  v32r2 (46d42edc)
PrecedenceSvc.h
Go to the documentation of this file.
1 #ifndef GAUDIHIVE_PRECEDENCESVC_H_
2 #define GAUDIHIVE_PRECEDENCESVC_H_
3 
4 #include "IPrecedenceSvc.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 public:
25  PrecedenceSvc( const std::string& name, ISvcLocator* svcLoc ) : base_class( name, svcLoc ) {}
26 
28  StatusCode initialize() override;
29 
31  StatusCode finalize() override;
32 
34  StatusCode iterate( EventSlot&, const Cause& ) override;
35 
37  StatusCode simulate( EventSlot& ) const override;
38 
40  bool CFRulesResolved( EventSlot& ) const override;
41 
43  uint getPriority( const std::string& name ) const override {
44  return (int)m_PRGraph.getAlgorithmNode( name )->getRank();
45  }
46 
48  bool isBlocking( const std::string& name ) const override { return m_PRGraph.getAlgorithmNode( name )->isIOBound(); }
49 
51  void dumpControlFlow() const override;
52  void dumpDataFlow() const override;
53  const std::string printState( EventSlot& ) const override;
54 
57  void dumpPrecedenceRules( EventSlot& ) override;
60  void dumpPrecedenceTrace( EventSlot& ) override;
61 
64 
65 private:
66  StatusCode assembleCFRules( Gaudi::Algorithm*, const std::string&, unsigned int recursionDepth = 0 );
67 
68 private:
74  Gaudi::Property<std::string> m_mode{this, "TaskPriorityRule", "", "Task avalanche induction strategy."};
76  Gaudi::Property<bool> m_ignoreDFRules{this, "IgnoreDFRules", false, "Ignore the data flow rules."};
79  boost::filesystem::unique_path( boost::filesystem::path( "precedence.analysis.%%%%" ) )};
80  Gaudi::Property<bool> m_dumpPrecTrace{this, "DumpPrecedenceTrace", false,
81  "Dump task precedence traces for each event."};
83  this, "PrecedenceTraceFile", "",
84  "Override default name of the GRAPHML trace file. NOTE: if more than "
85  "1 event is processed, the setting forces creation of a single file "
86  "with cumulative precedence trace."};
87  Gaudi::Property<bool> m_dumpPrecRules{this, "DumpPrecedenceRules", false, "Dump task precedence rules."};
88  Gaudi::Property<std::string> m_dumpPrecRulesFile{this, "PrecedenceRulesFile", "",
89  "Override default name of the GRAPHML precedence rules file."};
90  Gaudi::Property<bool> m_verifyRules{this, "VerifyTaskPrecedenceRules", true,
91  "Verify task precedence rules for common errors."};
92 };
93 
94 #endif /* GAUDIHIVE_PRECEDENCESVC_H_ */
Gaudi::Property< bool > m_dumpPrecTrace
Definition: PrecedenceSvc.h:80
concurrency::PrecedenceRulesGraph m_PRGraph
Graph of precedence rules.
Definition: PrecedenceSvc.h:72
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator.
Definition: Service.cpp:277
Class representing an event slot.
Definition: EventSlot.h:14
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
AlgorithmNode * getAlgorithmNode(const std::string &algoName) const
Get the AlgorithmNode from by algorithm name using graph index.
const std::string printState(EventSlot &) const override
StatusCode assembleCFRules(Gaudi::Algorithm *, const std::string &, unsigned int recursionDepth=0)
Implementation of property with value of concrete type.
Definition: Property.h:352
void dumpDataFlow() const override
A service to resolve the task execution precedence.
Definition: PrecedenceSvc.h:21
boost::filesystem::path m_dumpDirName
Precedence analysis facilities.
Definition: PrecedenceSvc.h:78
Gaudi::Property< bool > m_ignoreDFRules
Scheduling strategy.
Definition: PrecedenceSvc.h:76
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:88
const std::string & name() const override
Retrieve name of the service.
Definition: Service.cpp:274
SmartIF< IAlgResourcePool > m_algResourcePool
A shortcut to the algorithm resource pool.
Definition: PrecedenceSvc.h:70
bool isIOBound() const
Check if algorithm is I/O-bound.
Gaudi::Property< bool > m_verifyRules
Definition: PrecedenceSvc.h:90
StatusCode finalize() override
Finalize.
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
Gaudi::Property< std::string > m_mode
Scheduling strategy.
Definition: PrecedenceSvc.h:74
PrecedenceSvc(const std::string &name, ISvcLocator *svcLoc)
Constructor.
Definition: PrecedenceSvc.h:25
const float & getRank() const
Get Algorithm rank.
bool CFRulesResolved(EventSlot &) const override
Check if the root CF decision is resolved.
void dumpPrecedenceTrace(EventSlot &) override
Dump precedence trace (available only in DEBUG mode, and must be enabled with the corresponding servi...
Base class used to extend a class implementing other interfaces.
Definition: extends.h:10
Gaudi::Property< bool > m_dumpPrecRules
Definition: PrecedenceSvc.h:87
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:79
StatusCode simulate(EventSlot &) const override
Simulate execution flow.
Gaudi::Property< std::string > m_dumpPrecTraceFile
Definition: PrecedenceSvc.h:82
uint getPriority(const std::string &name) const override
Get priority of an algorithm.
Definition: PrecedenceSvc.h:43
bool isBlocking(const std::string &name) const override
Check if a task is CPU-blocking.
Definition: PrecedenceSvc.h:48
StatusCode initialize() override
Initialize.
const concurrency::PrecedenceRulesGraph * getRules() const
Precedence rules accessor.
Definition: PrecedenceSvc.h:63
void dumpControlFlow() const override
Dump precedence rules.