The Gaudi Framework  master (181af51f)
Loading...
Searching...
No Matches
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
29
30class PrecedenceSvc : public extends<Service, IPrecedenceSvc> {
31
32public:
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 {
58 return m_PRGraph.getAlgorithmNode( name )->isAsynchronous();
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
76private:
77 StatusCode assembleCFRules( Gaudi::Algorithm*, const std::string&, unsigned int recursionDepth = 0 );
78
79private:
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." };
89 boost::filesystem::path m_dumpDirName{
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};
Base class from which all concrete algorithm classes should be derived.
Definition Algorithm.h:87
Implementation of property with value of concrete type.
Definition PropertyFwd.h:27
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.
boost::filesystem::path m_dumpDirName
Precedence analysis facilities.
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.
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