The Gaudi Framework  master (9f3f8895)
Loading...
Searching...
No Matches
PrecedenceSvc.h
Go to the documentation of this file.
1/***********************************************************************************\
2* (c) Copyright 1998-2026 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// Local includes
14#include "IPrecedenceSvc.h"
16
17// Framework include
19#include <GaudiKernel/Service.h>
20
21// STL includes
22#include <cstdlib>
23#include <filesystem>
24#include <unistd.h>
25
33
34class PrecedenceSvc : public extends<Service, IPrecedenceSvc> {
35
36public:
38 PrecedenceSvc( const std::string& name, ISvcLocator* svcLoc ) : base_class( name, svcLoc ) {}
39
41 StatusCode initialize() override;
42
44 StatusCode finalize() override;
45
47 StatusCode iterate( EventSlot&, const Cause& ) override;
48
50 StatusCode simulate( EventSlot& ) const override;
51
53 bool CFRulesResolved( EventSlot& ) const override;
54
56 uint getPriority( const std::string& name ) const override {
57 return (int)m_PRGraph.getAlgorithmNode( name )->getRank();
58 }
59
61 bool isAsynchronous( const std::string& name ) const override {
62 return m_PRGraph.getAlgorithmNode( name )->isAsynchronous();
63 }
64
66 void dumpControlFlow() const override;
67 void dumpDataFlow() const override;
68 const std::string printState( EventSlot& ) const override;
69
72 void dumpPrecedenceRules( const EventSlot& ) override;
75 void dumpPrecedenceTrace( const EventSlot& ) override;
76
79
80private:
81 StatusCode assembleCFRules( Gaudi::Algorithm*, const std::string&, unsigned int recursionDepth = 0 );
82
83private:
89 Gaudi::Property<std::string> m_mode{ this, "TaskPriorityRule", "", "Task avalanche induction strategy." };
91 Gaudi::Property<bool> m_ignoreDFRules{ this, "IgnoreDFRules", false, "Ignore the data flow rules." };
93 std::filesystem::path m_dumpDirName;
94 Gaudi::Property<bool> m_dumpPrecTrace{ this, "DumpPrecedenceTrace", false,
95 "Dump task precedence traces for each event." };
97 this, "PrecedenceTraceFile", "",
98 "Override default name of the GRAPHML trace file. NOTE: if more than "
99 "1 event is processed, the setting forces creation of a single file "
100 "with cumulative precedence trace." };
101 Gaudi::Property<bool> m_dumpPrecRules{ this, "DumpPrecedenceRules", false, "Dump task precedence rules." };
102 Gaudi::Property<std::string> m_dumpPrecRulesFile{ this, "PrecedenceRulesFile", "",
103 "Override default name of the GRAPHML precedence rules file." };
104 Gaudi::Property<bool> m_verifyRules{ this, "VerifyTaskPrecedenceRules", true,
105 "Verify task precedence rules for common errors." };
106 Gaudi::Property<bool> m_showDataFlow{ this, "ShowDataFlow", false,
107 "Show the configuration of DataFlow between Algorithms" };
108};
Base class from which all concrete algorithm classes should be derived.
Definition Algorithm.h:87
Implementation of property with value of concrete type.
Definition Property.h:35
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition ISvcLocator.h:42
PrecedenceSvc(const std::string &name, ISvcLocator *svcLoc)
Constructor.
void dumpControlFlow() const override
Dump precedence rules.
Gaudi::Property< bool > m_showDataFlow
bool isAsynchronous(const std::string &name) const override
Check if a task is asynchronous.
concurrency::PrecedenceRulesGraph m_PRGraph
Graph of precedence rules.
Gaudi::Property< bool > m_dumpPrecTrace
Gaudi::Property< std::string > m_dumpPrecTraceFile
Gaudi::Property< bool > m_ignoreDFRules
Scheduling strategy.
Gaudi::Property< bool > m_dumpPrecRules
uint getPriority(const std::string &name) const override
Get priority of an algorithm.
StatusCode iterate(EventSlot &, const Cause &) override
Infer the precedence effect caused by an execution flow event.
Gaudi::Property< std::string > m_dumpPrecRulesFile
const std::string printState(EventSlot &) const override
StatusCode finalize() override
Finalize.
Gaudi::Property< bool > m_verifyRules
StatusCode simulate(EventSlot &) const override
Simulate execution flow.
SmartIF< IAlgResourcePool > m_algResourcePool
A shortcut to the algorithm resource pool.
void dumpPrecedenceRules(const EventSlot &) override
Dump precedence rules (available only in DEBUG mode, and must be enabled with the corresponding servi...
Gaudi::Property< std::string > m_mode
Scheduling strategy.
bool CFRulesResolved(EventSlot &) const override
Check if the root CF decision is resolved.
StatusCode initialize() override
Initialize.
void dumpPrecedenceTrace(const EventSlot &) override
Dump precedence trace (available only in DEBUG mode, and must be enabled with the corresponding servi...
const concurrency::PrecedenceRulesGraph * getRules() const
Precedence rules accessor.
std::filesystem::path m_dumpDirName
Precedence analysis facilities.
StatusCode assembleCFRules(Gaudi::Algorithm *, const std::string &, unsigned int recursionDepth=0)
void dumpDataFlow() const override
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator.
Definition Service.cpp:336
const std::string & name() const override
Retrieve name of the service.
Definition Service.cpp:333
Small smart pointer class with automatic reference counting for IInterface.
Definition SmartIF.h:28
This class is used for returning status codes from appropriate routines.
Definition StatusCode.h:64
Base class used to extend a class implementing other interfaces.
Definition extends.h:19
Class representing an event slot.
Definition EventSlot.h:23