| The Gaudi Framework v27r1

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

HiveEventLoopMgr.h
Go to the documentation of this file.
1 #ifndef GAUDIHIVE_HIVEEVENTLOOPMGR_H
2 #define GAUDIHIVE_HIVEEVENTLOOPMGR_H 1
3
4 // Framework include files
5 #include "GaudiKernel/IAlgResourcePool.h"
6 #include "GaudiKernel/IEvtSelector.h"
7 #include "GaudiKernel/IHiveWhiteBoard.h"
8 #include "GaudiKernel/MinimalEventLoopMgr.h"
9
10 // std includes
11 #include <atomic>
12
13 //include boost
14 #include <boost/dynamic_bitset.hpp>
15
16 // include tbb
17 #include "tbb/concurrent_vector.h"
18 #include "tbb/concurrent_queue.h"
19
20 // typedef for the event and algo state
21 typedef boost::dynamic_bitset<> state_type;
22
23 // Forward declarations
24 class IIncidentSvc;
25 class IDataManagerSvc;
26 class IDataProviderSvc;
27
28 namespace tbb {
29 class task_scheduler_init;
30 }
31
32 class HiveEventLoopMgr : public MinimalEventLoopMgr {
33 public:
34
35 protected:
37 SmartIF<IDataManagerSvc> m_evtDataMgrSvc;
39 SmartIF<IDataProviderSvc> m_evtDataSvc;
41 SmartIF<IEvtSelector> m_evtSelector;
43 IEvtSelector::Context* m_evtContext;
45 std::string m_evtsel;
47 SmartIF<IDataManagerSvc> m_histoDataMgrSvc;
49 SmartIF<IConversionSvc> m_histoPersSvc;
51 SmartIF<IHiveWhiteBoard> m_whiteboard;
53 SmartIF<IAlgResourcePool> m_algResourcePool;
55 std::string m_histPersName;
57 SmartIF<IProperty> m_appMgrProperty;
60 bool m_endEventFired;
62 bool m_warnings;
63
64 // Variables for the concurrency
66 unsigned int m_max_parallel;
68 tbb::task_scheduler_init* m_tbb_scheduler_init;
70 void find_dependencies();
72 state_type m_termination_requirement;
74 std::vector<state_type> m_all_requirements;
76 std::map<DataObjID,unsigned int> m_product_indices;
78 std::atomic_uint m_total_algos_in_flight;
80 unsigned int m_numberOfAlgos;
82 bool m_DumpQueues;
84 unsigned int m_evts_parallel;
86 unsigned int m_num_threads;
88 bool m_CloneAlgorithms;
90 // keep room for a class hashing strings instead of strings
91 typedef std::vector<std::vector<std::string>> algosDependenciesCollection;
92 // We just need the dependencies and not the algo names.
93 algosDependenciesCollection m_AlgosDependencies;
94 // Number of products to deal with
95 unsigned int m_nProducts;
96
97 public:
99 HiveEventLoopMgr(const std::string& nam, ISvcLocator* svcLoc);
101 virtual ~HiveEventLoopMgr();
103 StatusCode getEventRoot(IOpaqueAddress*& refpAddr);
104
106 virtual StatusCode initialize();
108 virtual StatusCode reinitialize();
110 virtual StatusCode stop();
112 virtual StatusCode finalize();
114 virtual StatusCode nextEvent(int maxevt);
116 virtual StatusCode executeEvent(void* par);
118 virtual StatusCode executeRun(int maxevt);
119
121 void taskFinished(IAlgorithm*& algo);
122
123 };
124 #endif // GAUDIHIVE_HIVEEVENTLOOPMGR_H
HiveEventLoopMgr::HiveEventLoopMgr
HiveEventLoopMgr(const std::string &nam, ISvcLocator *svcLoc)
Standard Constructor.
Definition: HiveEventLoopMgr.cpp:79
SmartIF< IDataManagerSvc >
HiveEventLoopMgr::m_nProducts
unsigned int m_nProducts
Definition: HiveEventLoopMgr.h:95
HiveEventLoopMgr::m_whiteboard
SmartIF< IHiveWhiteBoard > m_whiteboard
Reference to the Histogram Persistency Service.
Definition: HiveEventLoopMgr.h:51
ISvcLocator
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition: ISvcLocator.h:25
HiveEventLoopMgr::find_dependencies
void find_dependencies()
Get the input and output collections.
Definition: HiveEventLoopMgr.cpp:744
HiveEventLoopMgr::m_numberOfAlgos
unsigned int m_numberOfAlgos
Total number of algos.
Definition: HiveEventLoopMgr.h:80
HiveEventLoopMgr::m_max_parallel
unsigned int m_max_parallel
Maximum number of parallel running algorithms.
Definition: HiveEventLoopMgr.h:66
HiveEventLoopMgr::taskFinished
void taskFinished(IAlgorithm *&algo)
Decrement the number of algos in flight and put algo back in manager - maybe private.
Definition: HiveEventLoopMgr.cpp:787
IAlgResourcePool.h
HiveEventLoopMgr::m_algResourcePool
SmartIF< IAlgResourcePool > m_algResourcePool
Reference to the Algorithm resource pool.
Definition: HiveEventLoopMgr.h:53
HiveEventLoopMgr::m_CloneAlgorithms
bool m_CloneAlgorithms
Clone algorithms to run them simultaneously.
Definition: HiveEventLoopMgr.h:88
HiveEventLoopMgr::stop
virtual StatusCode stop()
implementation of IService::stop
Definition: HiveEventLoopMgr.cpp:287
IEvtSelector::Context
Definition: IEvtSelector.h:23
HiveEventLoopMgr::m_endEventFired
bool m_endEventFired
Flag to avoid to fire the EnvEvent incident twice in a row (and also not before the first event) ...
Definition: HiveEventLoopMgr.h:60
IDataProviderSvc
Data provider interface definition.
Definition: IDataProviderSvc.h:45
HiveEventLoopMgr::m_evtDataMgrSvc
SmartIF< IDataManagerSvc > m_evtDataMgrSvc
Reference to the Event Data Service's IDataManagerSvc interface.
Definition: HiveEventLoopMgr.h:37
std::map< DataObjID, unsigned int >
std::string
STL class.
state_type
boost::dynamic_bitset state_type
Definition: HiveEventLoopMgr.h:21
compareOutputFiles.par
string par
Definition: compareOutputFiles.py:386
HiveEventLoopMgr::m_histoPersSvc
SmartIF< IConversionSvc > m_histoPersSvc
Reference to the Histogram Persistency Service.
Definition: HiveEventLoopMgr.h:49
HiveEventLoopMgr::m_histoDataMgrSvc
SmartIF< IDataManagerSvc > m_histoDataMgrSvc
Reference to the Histogram Data Service.
Definition: HiveEventLoopMgr.h:47
HiveEventLoopMgr::finalize
virtual StatusCode finalize()
implementation of IService::finalize
Definition: HiveEventLoopMgr.cpp:299
HiveEventLoopMgr::m_evts_parallel
unsigned int m_evts_parallel
Number of events in parallel.
Definition: HiveEventLoopMgr.h:84
HiveEventLoopMgr::m_product_indices
std::map< DataObjID, unsigned int > m_product_indices
Register of input products.
Definition: HiveEventLoopMgr.h:76
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
HiveEventLoopMgr::m_evtSelector
SmartIF< IEvtSelector > m_evtSelector
Reference to the Event Selector.
Definition: HiveEventLoopMgr.h:41
HiveEventLoopMgr::nextEvent
virtual StatusCode nextEvent(int maxevt)
implementation of IService::nextEvent
Definition: HiveEventLoopMgr.cpp:442
HiveEventLoopMgr::m_evtsel
std::string m_evtsel
Event selector.
Definition: HiveEventLoopMgr.h:45
HiveEventLoopMgr::m_all_requirements
std::vector< state_type > m_all_requirements
All requirements.
Definition: HiveEventLoopMgr.h:74
HiveEventLoopMgr::m_appMgrProperty
SmartIF< IProperty > m_appMgrProperty
Property interface of ApplicationMgr.
Definition: HiveEventLoopMgr.h:57
IAlgorithm
The IAlgorithm is the interface implemented by the Algorithm base class.
Definition: IAlgorithm.h:25
HiveEventLoopMgr::m_evtDataSvc
SmartIF< IDataProviderSvc > m_evtDataSvc
Reference to the Event Data Service's IDataProviderSvc interface.
Definition: HiveEventLoopMgr.h:39
state_type
boost::dynamic_bitset state_type
Definition: EventSchedulingState.h:11
HiveEventLoopMgr::~HiveEventLoopMgr
virtual ~HiveEventLoopMgr()
Standard Destructor.
Definition: HiveEventLoopMgr.cpp:113
std::vector< state_type >
HiveEventLoopMgr::getEventRoot
StatusCode getEventRoot(IOpaqueAddress *&refpAddr)
Create event address using event selector.
Definition: HiveEventLoopMgr.cpp:717
HiveEventLoopMgr::m_num_threads
unsigned int m_num_threads
Total numbers of threads.
Definition: HiveEventLoopMgr.h:86
HiveEventLoopMgr::algosDependenciesCollection
std::vector< std::vector< std::string > > algosDependenciesCollection
Algorithms Inputs.
Definition: HiveEventLoopMgr.h:91
MinimalEventLoopMgr.h
IHiveWhiteBoard.h
IDataManagerSvc
Definition: IDataManagerSvc.h:45
HiveEventLoopMgr::executeRun
virtual StatusCode executeRun(int maxevt)
implementation of IEventProcessor::executeRun()
Definition: HiveEventLoopMgr.cpp:428
HiveEventLoopMgr::executeEvent
virtual StatusCode executeEvent(void *par)
implementation of IEventProcessor::executeEvent(void* par)
Definition: HiveEventLoopMgr.cpp:370
HiveEventLoopMgr::m_termination_requirement
state_type m_termination_requirement
The termination requirement.
Definition: HiveEventLoopMgr.h:72
tbb
Definition: HiveEventLoopMgr.h:28
HiveEventLoopMgr::m_total_algos_in_flight
std::atomic_uint m_total_algos_in_flight
Total number of algos in flight across all events.
Definition: HiveEventLoopMgr.h:78
HiveEventLoopMgr::m_warnings
bool m_warnings
Flag to disable warning messages when using external input.
Definition: HiveEventLoopMgr.h:62
HiveEventLoopMgr::m_AlgosDependencies
algosDependenciesCollection m_AlgosDependencies
Definition: HiveEventLoopMgr.h:93
IEvtSelector.h
HiveEventLoopMgr::m_histPersName
std::string m_histPersName
Name of the Hist Pers type.
Definition: HiveEventLoopMgr.h:55
MinimalEventLoopMgr
This is the default processing manager of the application manager.
Definition: MinimalEventLoopMgr.h:25
HiveEventLoopMgr::m_evtContext
IEvtSelector::Context * m_evtContext
Event Iterator.
Definition: HiveEventLoopMgr.h:43
HiveEventLoopMgr::reinitialize
virtual StatusCode reinitialize()
implementation of IService::reinitialize
Definition: HiveEventLoopMgr.cpp:217
HiveEventLoopMgr::m_tbb_scheduler_init
tbb::task_scheduler_init * m_tbb_scheduler_init
Pointer to tbb task scheduler.
Definition: HiveEventLoopMgr.h:68
IOpaqueAddress
Opaque address interface definition.
Definition: IOpaqueAddress.h:23
HiveEventLoopMgr::initialize
virtual StatusCode initialize()
implementation of IService::initialize
Definition: HiveEventLoopMgr.cpp:125
HiveEventLoopMgr
Definition: HiveEventLoopMgr.h:32
IIncidentSvc
The interface implemented by the IncidentSvc service.
Definition: IIncidentSvc.h:21
HiveEventLoopMgr::m_DumpQueues
bool m_DumpQueues
Dump the algorithm queues.
Definition: HiveEventLoopMgr.h:82