The Gaudi Framework  v30r3 (a5ef0a68)
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* svcLoc ) : base_class( name, svcLoc ) {}
27 
29  StatusCode initialize() override;
30 
32  StatusCode finalize() override;
33 
35  StatusCode iterate( EventSlot&, const Cause& ) override;
36 
38  StatusCode simulate( EventSlot& ) const override;
39 
41  bool CFRulesResolved( EventSlot& ) const override;
42 
44  uint getPriority( const std::string& name ) const override
45  {
46  return (int)m_PRGraph.getAlgorithmNode( name )->getRank();
47  }
48 
50  bool isBlocking( const std::string& name ) const override { return m_PRGraph.getAlgorithmNode( name )->isIOBound(); }
51 
53  void dumpControlFlow() const override;
54  void dumpDataFlow() const override;
55  const std::string printState( EventSlot& ) const override;
56 
59  void dumpPrecedenceRules( EventSlot& ) override;
62  void dumpPrecedenceTrace( EventSlot& ) override;
63 
66 
67 private:
68  StatusCode assembleCFRules( Algorithm*, const std::string&, unsigned int recursionDepth = 0 );
69 
70 private:
76  Gaudi::Property<std::string> m_mode{this, "TaskPriorityRule", "", "Task avalanche induction strategy."};
78  Gaudi::Property<bool> m_ignoreDFRules{this, "IgnoreDFRules", false, "Ignore the data flow rules."};
81  boost::filesystem::unique_path( boost::filesystem::path( "precedence.analysis.%%%%" ) )};
82  Gaudi::Property<bool> m_dumpPrecTrace{this, "DumpPrecedenceTrace", false,
83  "Dump task precedence traces for each event."};
85  this, "PrecedenceTraceFile", "", "Override default name of the GRAPHML trace file. NOTE: if more than "
86  "1 event is processed, the setting forces creation of a single file "
87  "with cumulative precedence trace."};
88  Gaudi::Property<bool> m_dumpPrecRules{this, "DumpPrecedenceRules", false, "Dump task precedence rules."};
89  Gaudi::Property<std::string> m_dumpPrecRulesFile{this, "PrecedenceRulesFile", "",
90  "Override default name of the GRAPHML precedence rules file."};
91 };
92 
93 #endif /* GAUDIHIVE_PRECEDENCESVC_H_ */
const concurrency::PrecedenceRulesGraph * getRules() const
Precedence rules accessor.
Definition: PrecedenceSvc.h:65
Gaudi::Property< bool > m_dumpPrecTrace
Definition: PrecedenceSvc.h:82
concurrency::PrecedenceRulesGraph m_PRGraph
Graph of precedence rules.
Definition: PrecedenceSvc.h:74
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:288
void dumpDataFlow() const override
Implementation of property with value of concrete type.
Definition: Property.h:381
StatusCode assembleCFRules(Algorithm *, const std::string &, unsigned int recursionDepth=0)
A service to resolve the task execution precedence.
Definition: PrecedenceSvc.h:21
boost::filesystem::path m_dumpDirName
Precedence analysis facilities.
Definition: PrecedenceSvc.h:80
bool isIOBound() const
Check if algorithm is I/O-bound.
Gaudi::Property< bool > m_ignoreDFRules
Scheduling strategy.
Definition: PrecedenceSvc.h:78
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:89
SmartIF< IAlgResourcePool > m_algResourcePool
A shortcut to the algorithm resource pool.
Definition: PrecedenceSvc.h:72
const float & getRank() const
Get Algorithm rank.
uint getPriority(const std::string &name) const override
Get priority of an algorithm.
Definition: PrecedenceSvc.h:44
StatusCode finalize() override
Finalize.
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:51
Gaudi::Property< std::string > m_mode
Scheduling strategy.
Definition: PrecedenceSvc.h:76
PrecedenceSvc(const std::string &name, ISvcLocator *svcLoc)
Constructor.
Definition: PrecedenceSvc.h:26
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:88
Class representing the event slot.
Definition: EventSlot.h:10
bool isBlocking(const std::string &name) const override
Check if a task is CPU-blocking.
Definition: PrecedenceSvc.h:50
Gaudi::Property< std::string > m_dumpPrecTraceFile
Definition: PrecedenceSvc.h:84
const std::string printState(EventSlot &) const override
void dumpControlFlow() const override
Dump precedence rules.
AlgorithmNode * getAlgorithmNode(const std::string &algoName) const
Get the AlgorithmNode from by algorithm name using graph index.
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator.
Definition: Service.cpp:291
StatusCode initialize() override
Initialize.