| The Gaudi Framework v32r1 (f65d50dc)

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 "PRGraph/PrecedenceRulesGraph.h"
6
7 // Framework include files
8 #include "GaudiKernel/IAlgResourcePool.h"
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
63 const concurrency::PrecedenceRulesGraph* getRules() const { return &m_PRGraph; };
64
65 private:
66 StatusCode assembleCFRules( Gaudi::Algorithm*, const std::string&, unsigned int recursionDepth = 0 );
67
68 private:
70 SmartIF<IAlgResourcePool> m_algResourcePool;
72 concurrency::PrecedenceRulesGraph m_PRGraph{"PrecedenceRulesGraph", serviceLocator()};
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."};
78 boost::filesystem::path m_dumpDirName{
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."};
82 Gaudi::Property<std::string> m_dumpPrecTraceFile{
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_ */
PrecedenceSvc::m_dumpPrecTrace
Gaudi::Property< bool > m_dumpPrecTrace
Definition: PrecedenceSvc.h:80
PrecedenceSvc::m_PRGraph
concurrency::PrecedenceRulesGraph m_PRGraph
Graph of precedence rules.
Definition: PrecedenceSvc.h:72
SmartIF< IAlgResourcePool >
Service::serviceLocator
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator.
Definition: Service.cpp:277
EventSlot
Class representing an event slot.
Definition: EventSlot.h:14
PrecedenceSvc::dumpPrecedenceRules
void dumpPrecedenceRules(EventSlot &) override
Dump precedence rules (available only in DEBUG mode, and must be enabled with the corresponding servi...
Definition: PrecedenceSvc.cpp:280
ISvcLocator
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition: ISvcLocator.h:25
concurrency::PrecedenceRulesGraph::getAlgorithmNode
AlgorithmNode * getAlgorithmNode(const std::string &algoName) const
Get the AlgorithmNode from by algorithm name using graph index.
Definition: PrecedenceRulesGraph.h:649
PrecedenceSvc::printState
const std::string printState(EventSlot &) const override
Definition: PrecedenceSvc.cpp:272
GaudiPython.HistoUtils.path
path
Definition: HistoUtils.py:932
PrecedenceSvc::assembleCFRules
StatusCode assembleCFRules(Gaudi::Algorithm *, const std::string &, unsigned int recursionDepth=0)
Definition: PrecedenceSvc.cpp:116
Gaudi::Property
Implementation of property with value of concrete type.
Definition: Property.h:352
PrecedenceSvc::dumpDataFlow
void dumpDataFlow() const override
Definition: PrecedenceSvc.cpp:266
PrecedenceSvc
A service to resolve the task execution precedence.
Definition: PrecedenceSvc.h:21
IAlgResourcePool.h
PrecedenceSvc::m_dumpDirName
boost::filesystem::path m_dumpDirName
Precedence analysis facilities.
Definition: PrecedenceSvc.h:78
IPrecedenceSvc.h
PrecedenceSvc::m_ignoreDFRules
Gaudi::Property< bool > m_ignoreDFRules
Scheduling strategy.
Definition: PrecedenceSvc.h:76
PrecedenceSvc::iterate
StatusCode iterate(EventSlot &, const Cause &) override
Infer the precedence effect caused by an execution flow event.
Definition: PrecedenceSvc.cpp:186
std::string
STL class.
Service.h
PrecedenceSvc::m_dumpPrecRulesFile
Gaudi::Property< std::string > m_dumpPrecRulesFile
Definition: PrecedenceSvc.h:88
Service::name
const std::string & name() const override
Retrieve name of the service.
Definition: Service.cpp:274
PrecedenceSvc::m_algResourcePool
SmartIF< IAlgResourcePool > m_algResourcePool
A shortcut to the algorithm resource pool.
Definition: PrecedenceSvc.h:70
concurrency::AlgorithmNode::isIOBound
bool isIOBound() const
Check if algorithm is I/O-bound.
Definition: PrecedenceRulesGraph.h:518
PrecedenceSvc::m_verifyRules
Gaudi::Property< bool > m_verifyRules
Definition: PrecedenceSvc.h:90
Cause
Definition: PrecedenceRulesGraph.h:387
PrecedenceSvc::finalize
StatusCode finalize() override
Finalize.
Definition: PrecedenceSvc.cpp:334
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
PrecedenceSvc::m_mode
Gaudi::Property< std::string > m_mode
Scheduling strategy.
Definition: PrecedenceSvc.h:74
PrecedenceSvc::PrecedenceSvc
PrecedenceSvc(const std::string &name, ISvcLocator *svcLoc)
Constructor.
Definition: PrecedenceSvc.h:25
concurrency::AlgorithmNode::getRank
const float & getRank() const
Get Algorithm rank.
Definition: PrecedenceRulesGraph.h:508
PrecedenceSvc::CFRulesResolved
bool CFRulesResolved(EventSlot &) const override
Check if the root CF decision is resolved.
Definition: PrecedenceSvc.cpp:255
PrecedenceSvc::dumpPrecedenceTrace
void dumpPrecedenceTrace(EventSlot &) override
Dump precedence trace (available only in DEBUG mode, and must be enabled with the corresponding servi...
Definition: PrecedenceSvc.cpp:306
concurrency::PrecedenceRulesGraph
Definition: PrecedenceRulesGraph.h:617
extends
Base class used to extend a class implementing other interfaces.
Definition: extends.h:10
PrecedenceSvc::m_dumpPrecRules
Gaudi::Property< bool > m_dumpPrecRules
Definition: PrecedenceSvc.h:87
Gaudi::Algorithm
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:79
PrecedenceSvc::simulate
StatusCode simulate(EventSlot &) const override
Simulate execution flow.
Definition: PrecedenceSvc.cpp:210
CommonMessaging
Definition: CommonMessaging.h:56
PrecedenceSvc::m_dumpPrecTraceFile
Gaudi::Property< std::string > m_dumpPrecTraceFile
Definition: PrecedenceSvc.h:82
PrecedenceSvc::getPriority
uint getPriority(const std::string &name) const override
Get priority of an algorithm.
Definition: PrecedenceSvc.h:43
PrecedenceRulesGraph.h
PrecedenceSvc::isBlocking
bool isBlocking(const std::string &name) const override
Check if a task is CPU-blocking.
Definition: PrecedenceSvc.h:48
PrecedenceSvc::initialize
StatusCode initialize() override
Initialize.
Definition: PrecedenceSvc.cpp:18
PrecedenceSvc::getRules
const concurrency::PrecedenceRulesGraph * getRules() const
Precedence rules accessor.
Definition: PrecedenceSvc.h:63
PrecedenceSvc::dumpControlFlow
void dumpControlFlow() const override
Dump precedence rules.
Definition: PrecedenceSvc.cpp:260