| The Gaudi Framework v32r1 (f65d50dc)

IOBoundAlgSchedulerSvc.h
Go to the documentation of this file.
1 #ifndef GAUDIHIVE_IOBOUNDALGSCHEDULERSVC_H
2 #define GAUDIHIVE_IOBOUNDALGSCHEDULERSVC_H
3
4 #include <functional>
5 #include <thread>
6
7 // Framework include files
8 #include "GaudiKernel/IAccelerator.h"
9 #include "GaudiKernel/IAlgTask.h"
10 #include "GaudiKernel/IRunable.h"
11 #include "GaudiKernel/Service.h"
12
13 // External libs
14 #include "tbb/concurrent_queue.h"
15
16 //---------------------------------------------------------------------------
17
25 class IOBoundAlgSchedulerSvc : public extends<Service, IAccelerator> {
26 public:
27 using extends::extends;
28
30 StatusCode initialize() override;
31
33 StatusCode finalize() override;
34
36 StatusCode push( IAlgTask& task ) override;
37
38 private:
39 // Utils and shortcuts ----------------------------------------------------
40
42 void activate();
43
45 StatusCode deactivate();
46
48 bool m_isActive = false;
49
51 std::thread m_thread;
52
53 // Actions management -----------------------------------------------------
54
55 typedef std::function<StatusCode()> action;
57 // typedef std::shared_ptr<action> actionPtr;
59 tbb::concurrent_bounded_queue<action> m_actionsQueue;
60 };
61
62 #endif // GAUDIHIVE_IOBOUNDALGSCHEDULERSVC_H
std::function
IAlgTask.h
IRunable.h
IOBoundAlgSchedulerSvc::m_isActive
bool m_isActive
Flag to track if the scheduler is active or not.
Definition: IOBoundAlgSchedulerSvc.h:48
IOBoundAlgSchedulerSvc::m_thread
std::thread m_thread
The thread in which the activate function runs.
Definition: IOBoundAlgSchedulerSvc.h:51
IOBoundAlgSchedulerSvc::action
std::function< StatusCode()> action
Definition: IOBoundAlgSchedulerSvc.h:55
IOBoundAlgSchedulerSvc::initialize
StatusCode initialize() override
Initialise.
Definition: IOBoundAlgSchedulerSvc.cpp:24
Service.h
IAlgTask
General interface for a wrapper around Gaudi algorithm.
Definition: IAlgTask.h:15
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
IOBoundAlgSchedulerSvc::deactivate
StatusCode deactivate()
Deactivate scheduler.
Definition: IOBoundAlgSchedulerSvc.cpp:87
extends
Base class used to extend a class implementing other interfaces.
Definition: extends.h:10
IOBoundAlgSchedulerSvc::activate
void activate()
Activate scheduler.
Definition: IOBoundAlgSchedulerSvc.cpp:61
IOBoundAlgSchedulerSvc::push
StatusCode push(IAlgTask &task) override
Add an algorithm to local queue to run on accelerator.
Definition: IOBoundAlgSchedulerSvc.cpp:104
IOBoundAlgSchedulerSvc::finalize
StatusCode finalize() override
Finalise.
Definition: IOBoundAlgSchedulerSvc.cpp:41
IOBoundAlgSchedulerSvc
Please refer to the full documentation of the methods for more details.
Definition: IOBoundAlgSchedulerSvc.h:25
IOBoundAlgSchedulerSvc::m_actionsQueue
tbb::concurrent_bounded_queue< action > m_actionsQueue
This is done since the copy of the lambda storage is too expensive.
Definition: IOBoundAlgSchedulerSvc.h:59
IAccelerator.h
std::thread
STL class.