The Gaudi Framework  v36r16 (ea80daf8)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
PrecedenceSvc.h
Go to the documentation of this file.
1 /***********************************************************************************\
2 * (c) Copyright 1998-2019 CERN for the benefit of the LHCb and ATLAS collaborations *
3 * *
4 * This software is distributed under the terms of the Apache version 2 licence, *
5 * copied verbatim in the file "LICENSE". *
6 * *
7 * In applying this licence, CERN does not waive the privileges and immunities *
8 * granted to it by virtue of its status as an Intergovernmental Organization *
9 * or submit itself to any jurisdiction. *
10 \***********************************************************************************/
11 #ifndef GAUDIHIVE_PRECEDENCESVC_H_
12 #define GAUDIHIVE_PRECEDENCESVC_H_
13 
14 #include "IPrecedenceSvc.h"
16 
17 // Framework include files
19 #include "GaudiKernel/Service.h"
20 
21 #include <boost/filesystem.hpp>
22 
31 class PrecedenceSvc : public extends<Service, IPrecedenceSvc> {
32 
33 public:
35  PrecedenceSvc( const std::string& name, ISvcLocator* svcLoc ) : base_class( name, svcLoc ) {}
36 
38  StatusCode initialize() override;
39 
41  StatusCode finalize() override;
42 
44  StatusCode iterate( EventSlot&, const Cause& ) override;
45 
47  StatusCode simulate( EventSlot& ) const override;
48 
50  bool CFRulesResolved( EventSlot& ) const override;
51 
53  uint getPriority( const std::string& name ) const override {
54  return (int)m_PRGraph.getAlgorithmNode( name )->getRank();
55  }
56 
58  bool isBlocking( const std::string& name ) const override { return m_PRGraph.getAlgorithmNode( name )->isBlocking(); }
59 
61  void dumpControlFlow() const override;
62  void dumpDataFlow() const override;
63  const std::string printState( EventSlot& ) const override;
64 
67  void dumpPrecedenceRules( const EventSlot& ) override;
70  void dumpPrecedenceTrace( const EventSlot& ) override;
71 
74 
75 private:
76  StatusCode assembleCFRules( Gaudi::Algorithm*, const std::string&, unsigned int recursionDepth = 0 );
77 
78 private:
84  Gaudi::Property<std::string> m_mode{ this, "TaskPriorityRule", "", "Task avalanche induction strategy." };
86  Gaudi::Property<bool> m_ignoreDFRules{ this, "IgnoreDFRules", false, "Ignore the data flow rules." };
89  boost::filesystem::unique_path( boost::filesystem::path( "precedence.analysis.%%%%" ) ) };
90  Gaudi::Property<bool> m_dumpPrecTrace{ this, "DumpPrecedenceTrace", false,
91  "Dump task precedence traces for each event." };
93  this, "PrecedenceTraceFile", "",
94  "Override default name of the GRAPHML trace file. NOTE: if more than "
95  "1 event is processed, the setting forces creation of a single file "
96  "with cumulative precedence trace." };
97  Gaudi::Property<bool> m_dumpPrecRules{ this, "DumpPrecedenceRules", false, "Dump task precedence rules." };
98  Gaudi::Property<std::string> m_dumpPrecRulesFile{ this, "PrecedenceRulesFile", "",
99  "Override default name of the GRAPHML precedence rules file." };
100  Gaudi::Property<bool> m_verifyRules{ this, "VerifyTaskPrecedenceRules", true,
101  "Verify task precedence rules for common errors." };
102  Gaudi::Property<bool> m_showDataFlow{ this, "ShowDataFlow", false,
103  "Show the configuration of DataFlow between Algorithms" };
104 };
105 
106 #endif /* GAUDIHIVE_PRECEDENCESVC_H_ */
PrecedenceSvc
A service to resolve the task execution precedence.
Definition: PrecedenceSvc.h:31
PrecedenceSvc::m_dumpPrecRules
Gaudi::Property< bool > m_dumpPrecRules
Definition: PrecedenceSvc.h:97
PrecedenceSvc::dumpPrecedenceTrace
void dumpPrecedenceTrace(const EventSlot &) override
Dump precedence trace (available only in DEBUG mode, and must be enabled with the corresponding servi...
Definition: PrecedenceSvc.cpp:337
IAlgResourcePool.h
std::string
STL class.
PrecedenceSvc::dumpPrecedenceRules
void dumpPrecedenceRules(const EventSlot &) override
Dump precedence rules (available only in DEBUG mode, and must be enabled with the corresponding servi...
Definition: PrecedenceSvc.cpp:310
PrecedenceSvc::m_PRGraph
concurrency::PrecedenceRulesGraph m_PRGraph
Graph of precedence rules.
Definition: PrecedenceSvc.h:82
AtlasMCRecoFullPrecedenceDump.path
path
Definition: AtlasMCRecoFullPrecedenceDump.py:49
PrecedenceSvc::isBlocking
bool isBlocking(const std::string &name) const override
Check if a task is CPU-blocking.
Definition: PrecedenceSvc.h:58
IPrecedenceSvc.h
PrecedenceSvc::m_dumpPrecTraceFile
Gaudi::Property< std::string > m_dumpPrecTraceFile
Definition: PrecedenceSvc.h:92
PrecedenceSvc::PrecedenceSvc
PrecedenceSvc(const std::string &name, ISvcLocator *svcLoc)
Constructor.
Definition: PrecedenceSvc.h:35
PrecedenceSvc::assembleCFRules
StatusCode assembleCFRules(Gaudi::Algorithm *, const std::string &, unsigned int recursionDepth=0)
Definition: PrecedenceSvc.cpp:146
ISvcLocator
Definition: ISvcLocator.h:46
EventSlot
Class representing an event slot.
Definition: EventSlot.h:24
concurrency::PrecedenceRulesGraph
Definition: PrecedenceRulesGraph.h:634
PrecedenceSvc::getRules
const concurrency::PrecedenceRulesGraph * getRules() const
Precedence rules accessor.
Definition: PrecedenceSvc.h:73
PrecedenceSvc::printState
const std::string printState(EventSlot &) const override
Definition: PrecedenceSvc.cpp:302
PrecedenceSvc::initialize
StatusCode initialize() override
Initialize.
Definition: PrecedenceSvc.cpp:28
PrecedenceSvc::m_verifyRules
Gaudi::Property< bool > m_verifyRules
Definition: PrecedenceSvc.h:100
PrecedenceSvc::m_algResourcePool
SmartIF< IAlgResourcePool > m_algResourcePool
A shortcut to the algorithm resource pool.
Definition: PrecedenceSvc.h:80
PrecedenceSvc::simulate
StatusCode simulate(EventSlot &) const override
Simulate execution flow.
Definition: PrecedenceSvc.cpp:240
PrecedenceSvc::dumpDataFlow
void dumpDataFlow() const override
Definition: PrecedenceSvc.cpp:296
Service::name
const std::string & name() const override
Retrieve name of the service
Definition: Service.cpp:332
StatusCode
Definition: StatusCode.h:65
PrecedenceSvc::m_dumpDirName
boost::filesystem::path m_dumpDirName
Precedence analysis facilities.
Definition: PrecedenceSvc.h:88
CommonMessaging
Definition: CommonMessaging.h:66
Gaudi::Algorithm
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:90
PrecedenceSvc::CFRulesResolved
bool CFRulesResolved(EventSlot &) const override
Check if the root CF decision is resolved.
Definition: PrecedenceSvc.cpp:285
PrecedenceSvc::m_dumpPrecTrace
Gaudi::Property< bool > m_dumpPrecTrace
Definition: PrecedenceSvc.h:90
SmartIF< IAlgResourcePool >
extends
Base class used to extend a class implementing other interfaces.
Definition: extends.h:20
PrecedenceSvc::iterate
StatusCode iterate(EventSlot &, const Cause &) override
Infer the precedence effect caused by an execution flow event.
Definition: PrecedenceSvc.cpp:216
Service.h
concurrency::PrecedenceRulesGraph::getAlgorithmNode
AlgorithmNode * getAlgorithmNode(const std::string &algoName) const
Get the AlgorithmNode from by algorithm name using graph index.
Definition: PrecedenceRulesGraph.h:666
PrecedenceSvc::m_ignoreDFRules
Gaudi::Property< bool > m_ignoreDFRules
Scheduling strategy.
Definition: PrecedenceSvc.h:86
PrecedenceSvc::m_dumpPrecRulesFile
Gaudi::Property< std::string > m_dumpPrecRulesFile
Definition: PrecedenceSvc.h:98
concurrency::AlgorithmNode::getRank
const float & getRank() const
Get Algorithm rank.
Definition: PrecedenceRulesGraph.h:520
PrecedenceSvc::dumpControlFlow
void dumpControlFlow() const override
Dump precedence rules.
Definition: PrecedenceSvc.cpp:290
PrecedenceSvc::getPriority
uint getPriority(const std::string &name) const override
Get priority of an algorithm.
Definition: PrecedenceSvc.h:53
PrecedenceSvc::m_showDataFlow
Gaudi::Property< bool > m_showDataFlow
Definition: PrecedenceSvc.h:102
concurrency::AlgorithmNode::isBlocking
bool isBlocking() const
Check if algorithm is CPU-blocking.
Definition: PrecedenceRulesGraph.h:530
PrecedenceRulesGraph.h
PrecedenceSvc::m_mode
Gaudi::Property< std::string > m_mode
Scheduling strategy.
Definition: PrecedenceSvc.h:84
Cause
Definition: PrecedenceRulesGraph.h:399
Gaudi::Property< std::string >
Service::serviceLocator
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator
Definition: Service.cpp:335
PrecedenceSvc::finalize
StatusCode finalize() override
Finalize.
Definition: PrecedenceSvc.cpp:366