Loading [MathJax]/extensions/tex2jax.js
The Gaudi Framework  master (d98a2936)
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-2025 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 #pragma once
12 
13 #include "IPrecedenceSvc.h"
15 
16 // Framework include files
18 #include <GaudiKernel/Service.h>
19 
20 #include <boost/filesystem.hpp>
21 
30 class PrecedenceSvc : public extends<Service, IPrecedenceSvc> {
31 
32 public:
34  PrecedenceSvc( const std::string& name, ISvcLocator* svcLoc ) : base_class( name, svcLoc ) {}
35 
37  StatusCode initialize() override;
38 
40  StatusCode finalize() override;
41 
43  StatusCode iterate( EventSlot&, const Cause& ) override;
44 
46  StatusCode simulate( EventSlot& ) const override;
47 
49  bool CFRulesResolved( EventSlot& ) const override;
50 
52  uint getPriority( const std::string& name ) const override {
53  return (int)m_PRGraph.getAlgorithmNode( name )->getRank();
54  }
55 
57  bool isAsynchronous( const std::string& name ) const override {
59  }
60 
62  void dumpControlFlow() const override;
63  void dumpDataFlow() const override;
64  const std::string printState( EventSlot& ) const override;
65 
68  void dumpPrecedenceRules( const EventSlot& ) override;
71  void dumpPrecedenceTrace( const EventSlot& ) override;
72 
75 
76 private:
77  StatusCode assembleCFRules( Gaudi::Algorithm*, const std::string&, unsigned int recursionDepth = 0 );
78 
79 private:
85  Gaudi::Property<std::string> m_mode{ this, "TaskPriorityRule", "", "Task avalanche induction strategy." };
87  Gaudi::Property<bool> m_ignoreDFRules{ this, "IgnoreDFRules", false, "Ignore the data flow rules." };
90  boost::filesystem::unique_path( boost::filesystem::path( "precedence.analysis.%%%%" ) ) };
91  Gaudi::Property<bool> m_dumpPrecTrace{ this, "DumpPrecedenceTrace", false,
92  "Dump task precedence traces for each event." };
94  this, "PrecedenceTraceFile", "",
95  "Override default name of the GRAPHML trace file. NOTE: if more than "
96  "1 event is processed, the setting forces creation of a single file "
97  "with cumulative precedence trace." };
98  Gaudi::Property<bool> m_dumpPrecRules{ this, "DumpPrecedenceRules", false, "Dump task precedence rules." };
99  Gaudi::Property<std::string> m_dumpPrecRulesFile{ this, "PrecedenceRulesFile", "",
100  "Override default name of the GRAPHML precedence rules file." };
101  Gaudi::Property<bool> m_verifyRules{ this, "VerifyTaskPrecedenceRules", true,
102  "Verify task precedence rules for common errors." };
103  Gaudi::Property<bool> m_showDataFlow{ this, "ShowDataFlow", false,
104  "Show the configuration of DataFlow between Algorithms" };
105 };
PrecedenceSvc
A service to resolve the task execution precedence.
Definition: PrecedenceSvc.h:30
PrecedenceSvc::m_dumpPrecRules
Gaudi::Property< bool > m_dumpPrecRules
Definition: PrecedenceSvc.h:98
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:340
IAlgResourcePool.h
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:313
PrecedenceSvc::m_PRGraph
concurrency::PrecedenceRulesGraph m_PRGraph
Graph of precedence rules.
Definition: PrecedenceSvc.h:83
AtlasMCRecoFullPrecedenceDump.path
path
Definition: AtlasMCRecoFullPrecedenceDump.py:49
IPrecedenceSvc.h
PrecedenceSvc::m_dumpPrecTraceFile
Gaudi::Property< std::string > m_dumpPrecTraceFile
Definition: PrecedenceSvc.h:93
PrecedenceSvc::PrecedenceSvc
PrecedenceSvc(const std::string &name, ISvcLocator *svcLoc)
Constructor.
Definition: PrecedenceSvc.h:34
PrecedenceSvc::assembleCFRules
StatusCode assembleCFRules(Gaudi::Algorithm *, const std::string &, unsigned int recursionDepth=0)
Definition: PrecedenceSvc.cpp:149
ISvcLocator
Definition: ISvcLocator.h:42
EventSlot
Class representing an event slot.
Definition: EventSlot.h:23
concurrency::PrecedenceRulesGraph
Definition: PrecedenceRulesGraph.h:621
PrecedenceSvc::getRules
const concurrency::PrecedenceRulesGraph * getRules() const
Precedence rules accessor.
Definition: PrecedenceSvc.h:74
PrecedenceSvc::printState
const std::string printState(EventSlot &) const override
Definition: PrecedenceSvc.cpp:305
PrecedenceSvc::initialize
StatusCode initialize() override
Initialize.
Definition: PrecedenceSvc.cpp:31
PrecedenceSvc::m_verifyRules
Gaudi::Property< bool > m_verifyRules
Definition: PrecedenceSvc.h:101
PrecedenceSvc::m_algResourcePool
SmartIF< IAlgResourcePool > m_algResourcePool
A shortcut to the algorithm resource pool.
Definition: PrecedenceSvc.h:81
PrecedenceSvc::simulate
StatusCode simulate(EventSlot &) const override
Simulate execution flow.
Definition: PrecedenceSvc.cpp:243
PrecedenceSvc::dumpDataFlow
void dumpDataFlow() const override
Definition: PrecedenceSvc.cpp:299
Service::name
const std::string & name() const override
Retrieve name of the service
Definition: Service.cpp:333
StatusCode
Definition: StatusCode.h:64
PrecedenceSvc::m_dumpDirName
boost::filesystem::path m_dumpDirName
Precedence analysis facilities.
Definition: PrecedenceSvc.h:89
CommonMessaging
Definition: CommonMessaging.h:65
Gaudi::Algorithm
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:87
PrecedenceSvc::CFRulesResolved
bool CFRulesResolved(EventSlot &) const override
Check if the root CF decision is resolved.
Definition: PrecedenceSvc.cpp:288
PrecedenceSvc::m_dumpPrecTrace
Gaudi::Property< bool > m_dumpPrecTrace
Definition: PrecedenceSvc.h:91
SmartIF< IAlgResourcePool >
PrecedenceSvc::isAsynchronous
bool isAsynchronous(const std::string &name) const override
Check if a task is asynchronous.
Definition: PrecedenceSvc.h:57
extends
Base class used to extend a class implementing other interfaces.
Definition: extends.h:19
concurrency::AlgorithmNode::getRank
float getRank() const
Get Algorithm rank.
Definition: PrecedenceRulesGraph.h:516
PrecedenceSvc::iterate
StatusCode iterate(EventSlot &, const Cause &) override
Infer the precedence effect caused by an execution flow event.
Definition: PrecedenceSvc.cpp:219
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:652
PrecedenceSvc::m_ignoreDFRules
Gaudi::Property< bool > m_ignoreDFRules
Scheduling strategy.
Definition: PrecedenceSvc.h:87
PrecedenceSvc::m_dumpPrecRulesFile
Gaudi::Property< std::string > m_dumpPrecRulesFile
Definition: PrecedenceSvc.h:99
PrecedenceSvc::dumpControlFlow
void dumpControlFlow() const override
Dump precedence rules.
Definition: PrecedenceSvc.cpp:293
PrecedenceSvc::getPriority
uint getPriority(const std::string &name) const override
Get priority of an algorithm.
Definition: PrecedenceSvc.h:52
PrecedenceSvc::m_showDataFlow
Gaudi::Property< bool > m_showDataFlow
Definition: PrecedenceSvc.h:103
PrecedenceRulesGraph.h
PrecedenceSvc::m_mode
Gaudi::Property< std::string > m_mode
Scheduling strategy.
Definition: PrecedenceSvc.h:85
concurrency::AlgorithmNode::isAsynchronous
bool isAsynchronous() const
Check if algorithm is asynchronous.
Definition: PrecedenceRulesGraph.h:526
Cause
Definition: PrecedenceRulesGraph.h:397
Gaudi::Property< std::string >
Service::serviceLocator
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator
Definition: Service.cpp:336
PrecedenceSvc::finalize
StatusCode finalize() override
Finalize.
Definition: PrecedenceSvc.cpp:369