| The Gaudi Framework v27r1

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

- File List
- File Members

RoundRobinSchedulerSvc.h
Go to the documentation of this file.
1 #ifndef GAUDIHIVE_ROUNDROBINSCHEDULERSVC_H
2 #define GAUDIHIVE_ROUNDROBINSCHEDULERSVC_H
3
4 // Framework include files
5 #include "GaudiKernel/IScheduler.h"
6 #include "GaudiKernel/IRunable.h"
7 #include "GaudiKernel/Service.h"
8 #include "GaudiKernel/IAlgResourcePool.h"
9
10 #include "AlgResourcePool.h"
11 #include "ExecutionFlowManager.h"
12 #include "DataFlowManager.h"
13
14
15 // C++ include files
16 #include <vector>
17 #include <string>
18 #include <unordered_map>
19 #include <functional>
20 #include <thread>
21
22 // External libs
23 #include "tbb/concurrent_queue.h"
24
25
26 //---------------------------------------------------------------------------
27
39 class RoundRobinSchedulerSvc: public extends<Service,
40 IScheduler> {
41 public:
43 RoundRobinSchedulerSvc( const std::string& name, ISvcLocator* svc );
44
46 ~RoundRobinSchedulerSvc();
47
49 virtual StatusCode initialize();
50
52 virtual StatusCode finalize();
53
55 virtual StatusCode pushNewEvent(EventContext* eventContext);
56
57 // Make multiple events available to the scheduler
58 virtual StatusCode pushNewEvents(std::vector<EventContext*>& eventContexts);
59
61 virtual StatusCode popFinishedEvent(EventContext*& eventContext);
62
64 virtual StatusCode tryPopFinishedEvent(EventContext*& eventContext);
65
67 virtual unsigned int freeSlots();
68
69
70 private:
71
72 StatusCode processEvents();
73
75 bool m_useTopAlgList;
76 SmartIF<IAlgResourcePool> m_algResourcePool;
77
78 //control flow manager
79 concurrency::ExecutionFlowManager m_controlFlow;
80
82 std::vector<std::string> m_algname_vect;
83
85 std::unordered_map<std::string,unsigned int> m_algname_index_map;
86
88 std::vector<std::vector<std::string>> m_algosDependencies;
89
91 std::list<IAlgorithm*> m_algList;
92
94 tbb::concurrent_bounded_queue<EventContext*> m_finishedEvents;
95
97 unsigned int m_freeSlots;
98 std::vector<EventContext*> m_evtCtx_buffer;
99
100 };
101
102 #endif // GAUDIHIVE_ROUNDROBINSCHEDULERSVC_H
RoundRobinSchedulerSvc::processEvents
StatusCode processEvents()
Definition: RoundRobinSchedulerSvc.cpp:119
RoundRobinSchedulerSvc::pushNewEvents
virtual StatusCode pushNewEvents(std::vector< EventContext * > &eventContexts)
Definition: RoundRobinSchedulerSvc.cpp:105
SmartIF< IAlgResourcePool >
ISvcLocator
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition: ISvcLocator.h:25
ExecutionFlowManager.h
RoundRobinSchedulerSvc::freeSlots
virtual unsigned int freeSlots()
Get free slots number.
Definition: RoundRobinSchedulerSvc.cpp:280
RoundRobinSchedulerSvc::finalize
virtual StatusCode finalize()
Finalise.
Definition: RoundRobinSchedulerSvc.cpp:78
IRunable.h
RoundRobinSchedulerSvc::m_algList
std::list< IAlgorithm * > m_algList
Cache the list of algs to be executed.
Definition: RoundRobinSchedulerSvc.h:91
IAlgResourcePool.h
RoundRobinSchedulerSvc::RoundRobinSchedulerSvc
RoundRobinSchedulerSvc(const std::string &name, ISvcLocator *svc)
Constructor.
Definition: RoundRobinSchedulerSvc.cpp:26
RoundRobinSchedulerSvc::popFinishedEvent
virtual StatusCode popFinishedEvent(EventContext *&eventContext)
Blocks until an event is availble.
Definition: RoundRobinSchedulerSvc.cpp:251
RoundRobinSchedulerSvc::m_useTopAlgList
bool m_useTopAlgList
Decide if the top alglist or its flat version has to be used.
Definition: RoundRobinSchedulerSvc.h:75
IScheduler.h
EventContext
This class represents an entry point to all the event specific data.
Definition: EventContext.h:25
RoundRobinSchedulerSvc::m_freeSlots
unsigned int m_freeSlots
The number of free slots (0 or 1)
Definition: RoundRobinSchedulerSvc.h:97
RoundRobinSchedulerSvc::m_algosDependencies
std::vector< std::vector< std::string > > m_algosDependencies
Ugly, will disappear when the deps are declared only within the C++ code of the algos.
Definition: RoundRobinSchedulerSvc.h:88
RoundRobinSchedulerSvc::m_algResourcePool
SmartIF< IAlgResourcePool > m_algResourcePool
Definition: RoundRobinSchedulerSvc.h:76
std::string
STL class.
Service.h
Service::name
const std::string & name() const override
Retrieve name of the service.
Definition: Service.cpp:319
RoundRobinSchedulerSvc::m_algname_index_map
std::unordered_map< std::string, unsigned int > m_algname_index_map
Map to bookkeep the information necessary to the name2index conversion.
Definition: RoundRobinSchedulerSvc.h:85
concurrency::ExecutionFlowManager
Manage the execution flow using an execution flow graph Once initialized, the graph is const and can ...
Definition: ExecutionFlowManager.h:21
RoundRobinSchedulerSvc::tryPopFinishedEvent
virtual StatusCode tryPopFinishedEvent(EventContext *&eventContext)
Try to fetch an event from the scheduler.
Definition: RoundRobinSchedulerSvc.cpp:265
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
RoundRobinSchedulerSvc::m_algname_vect
std::vector< std::string > m_algname_vect
Vector to bookkeep the information necessary to the index2name conversion.
Definition: RoundRobinSchedulerSvc.h:82
RoundRobinSchedulerSvc::pushNewEvent
virtual StatusCode pushNewEvent(EventContext *eventContext)
Make an event available to the scheduler.
Definition: RoundRobinSchedulerSvc.cpp:90
std::list< IAlgorithm * >
RoundRobinSchedulerSvc::m_controlFlow
concurrency::ExecutionFlowManager m_controlFlow
Definition: RoundRobinSchedulerSvc.h:79
std::vector< EventContext * >
RoundRobinSchedulerSvc::initialize
virtual StatusCode initialize()
Initialise.
Definition: RoundRobinSchedulerSvc.cpp:36
extends
Base class used to extend a class implementing other interfaces.
Definition: extends.h:10
RoundRobinSchedulerSvc::m_finishedEvents
tbb::concurrent_bounded_queue< EventContext * > m_finishedEvents
Queue of finished events.
Definition: RoundRobinSchedulerSvc.h:94
AlgResourcePool.h
DataFlowManager.h
RoundRobinSchedulerSvc::~RoundRobinSchedulerSvc
~RoundRobinSchedulerSvc()
Destructor.
Definition: RoundRobinSchedulerSvc.cpp:33
RoundRobinSchedulerSvc::m_evtCtx_buffer
std::vector< EventContext * > m_evtCtx_buffer
Definition: RoundRobinSchedulerSvc.h:98
RoundRobinSchedulerSvc
The RoundRobinSchedulerSvc implements the IScheduler interface.
Definition: RoundRobinSchedulerSvc.h:39
std::unordered_map< std::string, unsigned int >