| The Gaudi Framework v27r1

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

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Private Attributes | Friends | List of all members
ParallelSequentialSchedulerSvc Class Reference

This SchedulerSvc implements the IScheduler interface. More...

`#include <src/ParallelSequentialSchedulerSvc.h>`

Inheritance diagram for ParallelSequentialSchedulerSvc:
[legend]
Collaboration diagram for ParallelSequentialSchedulerSvc:
[legend]

## Public Member Functions
| ParallelSequentialSchedulerSvc (const std::string &name, ISvcLocator *svc)
| Constructor. More...
| ~ParallelSequentialSchedulerSvc ()
| Destructor. More...
virtual StatusCode | initialize ()
| Initialise. More...
virtual StatusCode | finalize ()
| Finalise. More...
virtual StatusCode | pushNewEvent (EventContext *eventContext)
| Make an event available to the scheduler. More...
virtual StatusCode | pushNewEvents (std::vector< EventContext * > &eventContexts)
virtual StatusCode | popFinishedEvent (EventContext *&eventContext)
| Blocks until an event is availble. More...
virtual StatusCode | tryPopFinishedEvent (EventContext *&eventContext)
| Try to fetch an event from the scheduler. More...
virtual unsigned int | freeSlots ()
| Get free slots number. More...
Public Member Functions inherited from extends< Service, IScheduler >
void * | i_cast (const InterfaceID &tid) const override
| Implementation of IInterface::i_cast. More...
StatusCode | queryInterface (const InterfaceID &ti, void **pp) override
| Implementation of IInterface::queryInterface. More...
std::vector< std::string > | getInterfaceNames () const override
| Implementation of IInterface::getInterfaceNames. More...
| ~extends () override=default
| Virtual destructor. More...
Public Member Functions inherited from Service
const std::string & | name () const override
| Retrieve name of the service. More...
StatusCode | configure () override
StatusCode | initialize () override
StatusCode | start () override
StatusCode | stop () override
StatusCode | finalize () override
StatusCode | terminate () override
Gaudi::StateMachine::State | FSMState () const override
Gaudi::StateMachine::State | targetFSMState () const override
StatusCode | reinitialize () override
StatusCode | restart () override
StatusCode | sysInitialize () override
| Initialize Service. More...
StatusCode | sysStart () override
| Initialize Service. More...
StatusCode | sysStop () override
| Initialize Service. More...
StatusCode | sysFinalize () override
| Finalize Service. More...
StatusCode | sysReinitialize () override
| Re-initialize the Service. More...
StatusCode | sysRestart () override
| Re-initialize the Service. More...
StatusCode | setProperty (const Property &p) override
StatusCode | setProperty (const std::string &s) override
StatusCode | setProperty (const std::string &n, const std::string &v) override
StatusCode | getProperty (Property *p) const override
const Property & | getProperty (const std::string &name) const override
StatusCode | getProperty (const std::string &n, std::string &v) const override
const std::vector< Property * > & | getProperties () const override
bool | hasProperty (const std::string &name) const override
template<class TYPE >
StatusCode | setProperty (const std::string &name, const TYPE &value)
| set the property form the value More...
| Service (std::string name, ISvcLocator *svcloc)
| Standard Constructor. More...
SmartIF< ISvcLocator > & | serviceLocator () const override
| Retrieve pointer to service locator. More...
StatusCode | setProperties ()
| Method for setting declared properties to the values specified for the job. More...
template<class T >
StatusCode | service (const std::string &name, const T *&psvc, bool createIf=true) const
| Access a service by name, creating it if it doesn't already exist. More...
template<class T >
StatusCode | service (const std::string &name, T *&psvc, bool createIf=true) const
template<typename IFace = IService>
SmartIF< IFace > | service (const std::string &name, bool createIf=true) const
template<class T >
StatusCode | service (const std::string &svcType, const std::string &svcName, T *&psvc) const
| Access a service by name and type, creating it if it doesn't already exist. More...
template<class T >
Property * | declareProperty (const std::string &name, T &property, const std::string &doc="none") const
| Declare the named property. More...
Property * | declareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="") const
| Declare remote named properties. More...
template<class T >
StatusCode | declarePrivateTool (ToolHandle< T > &handle, std::string toolTypeAndName="", bool createIf=true)
| Declare used Private tool. More...
template<class T >
StatusCode | declarePublicTool (ToolHandle< T > &handle, std::string toolTypeAndName="", bool createIf=true)
| Declare used Public tool. More...
SmartIF< IAuditorSvc > & | auditorSvc () const
| The standard auditor service.May not be invoked before sysInitialize() has been invoked. More...
Public Member Functions inherited from CommonMessagingBase
virtual | ~CommonMessagingBase ()=default
| Virtual destructor. More...
SmartIF< IMessageSvc > & | msgSvc () const
| The standard message service. More...
MsgStream & | msgStream () const
| Return an uninitialized MsgStream. More...
MsgStream & | msgStream (const MSG::Level level) const
| Predefined configurable message stream for the efficient printouts. More...
MsgStream & | always () const
| shortcut for the method msgStream(MSG::ALWAYS) More...
MsgStream & | fatal () const
| shortcut for the method msgStream(MSG::FATAL) More...
MsgStream & | err () const
| shortcut for the method msgStream(MSG::ERROR) More...
MsgStream & | error () const
| shortcut for the method msgStream(MSG::ERROR) More...
MsgStream & | warning () const
| shortcut for the method msgStream(MSG::WARNING) More...
MsgStream & | info () const
| shortcut for the method msgStream(MSG::INFO) More...
MsgStream & | debug () const
| shortcut for the method msgStream(MSG::DEBUG) More...
MsgStream & | verbose () const
| shortcut for the method msgStream(MSG::VERBOSE) More...
MsgStream & | msg () const
| shortcut for the method msgStream(MSG::INFO) More...
MSG::Level | msgLevel () const
| get the output level from the embedded MsgStream More...
MSG::Level | outputLevel () const __attribute__((deprecated))
| Backward compatibility function for getting the output level. More...
bool | msgLevel (MSG::Level lvl) const
| get the output level from the embedded MsgStream More...
Public Member Functions inherited from extend_interfaces< Interfaces...>
| ~extend_interfaces () override=default
| Virtual destructor. More...

## Private Attributes
bool | m_useTopAlgList
| Decide if the top alglist or its flat version has to be used. More...
std::list< IAlgorithm * > | m_algList
| Cache the list of algs to be executed. More...
tbb::concurrent_bounded_queue< EventContext * > | m_finishedEvents
| Queue of finished events. More...
std::atomic_int | m_freeSlots
| Atomic to account for asyncronous updates by the scheduler wrt the rest. More...
SmartIF< IHiveWhiteBoard > | m_whiteboard
| A shortcut to the whiteboard. More...
std::string | m_whiteboardSvcName
| The whiteboard name. More...
SmartIF< IAlgResourcePool > | m_algResourcePool
| Cache for the algorithm resource pool. More...
int | m_threadPoolSize
| Size of the threadpool initialised by TBB; a value of -1 gives TBB the freedom to choose. More...
std::unique_ptr< tbb::task_scheduler_init > | m_tbb_sched
concurrency::ExecutionFlowManager | m_controlFlow
std::vector< std::string > | m_algname_vect
| Vector to bookkeep the information necessary to the index2name conversion. More...
std::unordered_map< std::string, unsigned int > | m_algname_index_map
| Map to bookkeep the information necessary to the name2index conversion. More...

## Friends
class | SequentialTask

## Additional Inherited Members
Public Types inherited from extends< Service, IScheduler >
using | base_class = extends
| Typedef to this class. More...
using | extend_interfaces_base = extend_interfaces< Interfaces...>
| Typedef to the base of this class. More...
Public Types inherited from Service
typedef Gaudi::PluginService::Factory< IService *, const std::string &, ISvcLocator * > | Factory
Public Types inherited from CommonMessaging< implements< IService, IProperty, IStateful > >
using | base_class = CommonMessaging
Public Types inherited from extend_interfaces< Interfaces...>
using | ext_iids = typename Gaudi::interface_list_cat< typename Interfaces::ext_iids...>::type
| take union of the ext_iids of all Interfaces... More...
Protected Member Functions inherited from Service
| ~Service () override
| Standard Destructor. More...
int | outputLevel () const
| get the `Service's` output level More...
Protected Member Functions inherited from CommonMessaging< implements< IService, IProperty, IStateful > >
void | updateMsgStreamOutputLevel (int level)
| Update the output level of the cached MsgStream. More...
Protected Attributes inherited from Service
IntegerProperty | m_outputLevel = MSG::NIL
| Service output level. More...
Gaudi::StateMachine::State | m_state = Gaudi::StateMachine::OFFLINE
| Service state. More...
Gaudi::StateMachine::State | m_targetState = Gaudi::StateMachine::OFFLINE
| Service state. More...

## Detailed Description

This SchedulerSvc implements the IScheduler interface.

It executes all the algorithms in sequence for several events in flight. It pulls the algorithms from the AlgResourcePool

Author
  Daniel Funke

Version
  0.1

Definition at line 41 of file ParallelSequentialSchedulerSvc.h.

## Constructor & Destructor Documentation

ParallelSequentialSchedulerSvc::ParallelSequentialSchedulerSvc | ( | const std::string & | name,
|  | ISvcLocator * | svc
| ) |  |

Constructor.

Definition at line 28 of file ParallelSequentialSchedulerSvc.cpp.

28 :
29 base_class(name,svcLoc) {
30
31 declareProperty("UseTopAlgList", m_useTopAlgList = false);
32 declareProperty("ThreadPoolSize", m_threadPoolSize = -1);
33 declareProperty("WhiteboardSvc", m_whiteboardSvcName = "EventDataSvc");
34
35 }
extends< Service, IScheduler >::base_class
extends base_class
Typedef to this class.
Definition: extends.h:14
ParallelSequentialSchedulerSvc::m_useTopAlgList
bool m_useTopAlgList
Decide if the top alglist or its flat version has to be used.
Definition: ParallelSequentialSchedulerSvc.h:75
ParallelSequentialSchedulerSvc::m_threadPoolSize
int m_threadPoolSize
Size of the threadpool initialised by TBB; a value of -1 gives TBB the freedom to choose...
Definition: ParallelSequentialSchedulerSvc.h:97
ParallelSequentialSchedulerSvc::m_whiteboardSvcName
std::string m_whiteboardSvcName
The whiteboard name.
Definition: ParallelSequentialSchedulerSvc.h:91
Service::declareProperty
Property * declareProperty(const std::string &name, T &property, const std::string &doc="none") const
Declare the named property.
Definition: Service.h:215

ParallelSequentialSchedulerSvc::~ParallelSequentialSchedulerSvc | ( |  | ) |

Destructor.

Definition at line 38 of file ParallelSequentialSchedulerSvc.cpp.

38 {}

## Member Function Documentation

StatusCode ParallelSequentialSchedulerSvc::finalize | ( |  | ) |
| virtual

Finalise.

Definition at line 148 of file ParallelSequentialSchedulerSvc.cpp.

148 {
149 m_tbb_sched.reset();
150
151 StatusCode sc(Service::finalize());
152 if (!sc.isSuccess())
153 warning () << "Base class could not be finalized" << endmsg;
154 return sc;
155 }
Service::finalize
StatusCode finalize() override
Definition: Service.cpp:193
ParallelSequentialSchedulerSvc::m_tbb_sched
std::unique_ptr< tbb::task_scheduler_init > m_tbb_sched
Definition: ParallelSequentialSchedulerSvc.h:100
merge_files.sc
int sc
Definition: merge_files.py:167
CommonMessagingBase::warning
MsgStream & warning() const
shortcut for the method msgStream(MSG::WARNING)
Definition: CommonMessaging.h:121
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
std::unique_ptr::reset
T reset(T...args)
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244

unsigned int ParallelSequentialSchedulerSvc::freeSlots | ( |  | ) |
| virtual

Get free slots number.

Given that the scheduler is sequential and its methods non reentrant, this is always 1.

Definition at line 220 of file ParallelSequentialSchedulerSvc.cpp.

220 {return m_freeSlots;}
ParallelSequentialSchedulerSvc::m_freeSlots
std::atomic_int m_freeSlots
Atomic to account for asyncronous updates by the scheduler wrt the rest.
Definition: ParallelSequentialSchedulerSvc.h:85

StatusCode ParallelSequentialSchedulerSvc::initialize | ( |  | ) |
| virtual

Initialise.

Definition at line 41 of file ParallelSequentialSchedulerSvc.cpp.

41 {
42
43 // Initialise mother class (read properties, ...)
44 StatusCode sc(Service::initialize());
45 if (!sc.isSuccess())
46 warning () << "Base class could not be initialized" << endmsg;
47
48 // Get the algo resource pool
49 m_algResourcePool = serviceLocator()->service("AlgResourcePool");
50 if (!m_algResourcePool.isValid()){
51 error() << "Error retrieving AlgResourcePool" << endmsg;
52 return StatusCode::FAILURE;
53 }
54
55 // Get the list of algorithms
56 m_algList = m_useTopAlgList ? m_algResourcePool->getTopAlgList() : m_algResourcePool->getFlatAlgList();
57 info() << "Found " << m_algList.size() << " algorithms" << endmsg;
58
59 // Get Whiteboard
60 m_whiteboard = serviceLocator()->service(m_whiteboardSvcName);
61 if (!m_whiteboard.isValid())
62 fatal() << "Error retrieving EventDataSvc interface IHiveWhiteBoard." << endmsg;
63
64 // Check the MaxEventsInFlight parameters and react
65 // Deprecated for the moment
66 size_t numberOfWBSlots = m_whiteboard->getNumberOfStores();
67
68 // Set the number of free slots
69 m_freeSlots=numberOfWBSlots;
70
71 info() << "Allowing " << m_freeSlots << " events in flight" << endmsg;
72
73 if(m_threadPoolSize == -1)
74 m_threadPoolSize = numberOfWBSlots;
75
76 debug() << "Initialising a TBB thread pool of size " << m_threadPoolSize << endmsg;
77 m_tbb_sched.reset(new tbb::task_scheduler_init(m_threadPoolSize));
78
79 // Fill the containers to convert algo names to index
80 m_algname_index_map.reserve(m_algList.size());
81 m_algname_vect.reserve(m_algList.size());
82 unsigned int index=0;
83 for (IAlgorithm* algo : m_algList){
84 const std::string& name = algo->name();
85 m_algname_index_map[name]=index;
86 m_algname_vect.emplace_back(name);
87 index++;
88 }
89
90 //initialize control flow manager
91 const AlgResourcePool* algPool = dynamic_cast<const AlgResourcePool*>(m_algResourcePool.get());
92
93 m_controlFlow.initialize(algPool->getExecutionFlowGraph(), m_algname_index_map);
94
95 const unsigned int algosDependenciesSize=0;
96 info() << "Algodependecies size is " << algosDependenciesSize << endmsg;
97
98 //get algorithm dependencies
99 /* Dependencies
100 0) Read deps from config file
101 1) Look for handles in algo, if none
102 2) Assume none are required
103 */
104 if (algosDependenciesSize == 0){
105 // Get the event root from the IDataManagerSvc interface of the WhiteBoard
106 SmartIF<IDataManagerSvc> dataMgrSvc (m_whiteboard);
107 std::string rootInTESName(dataMgrSvc->rootName());
108 if ("" != rootInTESName && '/'!=rootInTESName[rootInTESName.size()-1]){
109 rootInTESName = rootInTESName+"/";
110 }
111
112 for (IAlgorithm* ialgoPtr : m_algList){
113 Algorithm* algoPtr = dynamic_cast<Algorithm*> (ialgoPtr);
114 if (nullptr == algoPtr){
115 fatal() << "Could not convert IAlgorithm into Algorithm: this will result in a crash." << endmsg;
116 }
117
118 std::vector<Gaudi::DataHandle*> algoHandles(algoPtr->inputHandles());
119 DataObjIDColl algoDependencies;
120 if (!algoHandles.empty()){
121 info() << "Algorithm " << algoPtr->name() << " data dependencies:" << endmsg;
122
123 DataObjIDColl inputObjs, outputObjs;
124 DHHVisitor avis(inputObjs, outputObjs);
125
126 algoPtr->acceptDHVisitor( &avis );
127
128 for (auto id : inputObjs) {
129 const std::string& productName = rootInTESName + id.key();
130 info() << " o Input dep for " << productName << endmsg;
131 algoDependencies.insert(id);
132 }
133
134
135 } else {
136 info() << "Algorithm " << algoPtr->name() << " has no data dependencies."
137 << endmsg;
138 }
139
140 }
141 }
142
143 return StatusCode::SUCCESS;
144
145 }
ParallelSequentialSchedulerSvc::m_algList
std::list< IAlgorithm * > m_algList
Cache the list of algs to be executed.
Definition: ParallelSequentialSchedulerSvc.h:78
Service::initialize
StatusCode initialize() override
Definition: Service.cpp:68
SmartIF< IDataManagerSvc >
Service::serviceLocator
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator.
Definition: Service.cpp:324
CommonMessagingBase::info
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
Definition: CommonMessaging.h:124
ParallelSequentialSchedulerSvc::m_tbb_sched
std::unique_ptr< tbb::task_scheduler_init > m_tbb_sched
Definition: ParallelSequentialSchedulerSvc.h:100
IHiveWhiteBoard::getNumberOfStores
virtual size_t getNumberOfStores()=0
Get the number of 'slots'.
IAlgResourcePool::getFlatAlgList
virtual std::list< IAlgorithm * > getFlatAlgList()=0
Get the flat list of algorithms.
merge_files.sc
int sc
Definition: merge_files.py:167
AlgResourcePool
The AlgResourcePool is a concrete implementation of the IAlgResourcePool interface.
Definition: AlgResourcePool.h:34
std::string
STL class.
Algorithm::name
const std::string & name() const override
The identifying name of the algorithm object.
Definition: Algorithm.cpp:820
SmartIF::get
TYPE * get() const
Get interface pointer.
Definition: SmartIF.h:76
ISvcLocator::service
StatusCode service(const Gaudi::Utils::TypeNameString &name, T *&svc, bool createIf=true)
Templated method to access a service by name.
Definition: ISvcLocator.h:78
Service::name
const std::string & name() const override
Retrieve name of the service.
Definition: Service.cpp:319
ParallelSequentialSchedulerSvc::m_useTopAlgList
bool m_useTopAlgList
Decide if the top alglist or its flat version has to be used.
Definition: ParallelSequentialSchedulerSvc.h:75
CommonMessagingBase::error
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Definition: CommonMessaging.h:118
ParallelSequentialSchedulerSvc::m_whiteboard
SmartIF< IHiveWhiteBoard > m_whiteboard
A shortcut to the whiteboard.
Definition: ParallelSequentialSchedulerSvc.h:88
ParallelSequentialSchedulerSvc::m_threadPoolSize
int m_threadPoolSize
Size of the threadpool initialised by TBB; a value of -1 gives TBB the freedom to choose...
Definition: ParallelSequentialSchedulerSvc.h:97
IAlgResourcePool::getTopAlgList
virtual std::list< IAlgorithm * > getTopAlgList()=0
Get top list of algorithms.
CommonMessagingBase::warning
MsgStream & warning() const
shortcut for the method msgStream(MSG::WARNING)
Definition: CommonMessaging.h:121
StatusCode::FAILURE
Definition: StatusCode.h:29
StatusCode::SUCCESS
Definition: StatusCode.h:30
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
ParallelSequentialSchedulerSvc::m_whiteboardSvcName
std::string m_whiteboardSvcName
The whiteboard name.
Definition: ParallelSequentialSchedulerSvc.h:91
DHHVisitor
Definition: DataHandleHolderVisitor.h:9
ParallelSequentialSchedulerSvc::m_freeSlots
std::atomic_int m_freeSlots
Atomic to account for asyncronous updates by the scheduler wrt the rest.
Definition: ParallelSequentialSchedulerSvc.h:85
std::unordered_set< DataObjID, DataObjID_Hasher >
std::unique_ptr::reset
T reset(T...args)
AlgResourcePool::getExecutionFlowGraph
virtual concurrency::ExecutionFlowGraph * getExecutionFlowGraph() const
Definition: AlgResourcePool.h:61
IAlgorithm
The IAlgorithm is the interface implemented by the Algorithm base class.
Definition: IAlgorithm.h:25
std::vector::insert
T insert(T...args)
Algorithm
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:74
std::list::size
T size(T...args)
std::vector< Gaudi::DataHandle * >
CommonMessagingBase::debug
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
Definition: CommonMessaging.h:127
SmartIF::isValid
bool isValid() const
Allow for check if smart pointer is valid.
Definition: SmartIF.h:62
Algorithm::acceptDHVisitor
virtual void acceptDHVisitor(IDataHandleVisitor *) const override
Definition: Algorithm.cpp:226
CommonMessagingBase::fatal
MsgStream & fatal() const
shortcut for the method msgStream(MSG::FATAL)
Definition: CommonMessaging.h:112
concurrency::ExecutionFlowManager::initialize
StatusCode initialize(ExecutionFlowGraph *CFGraph, const std::unordered_map< std::string, unsigned int > &algname_index_map)
Initialize the control flow manager It greps the topalg list and the index map for the algo names...
Definition: ExecutionFlowManager.cpp:6
ParallelSequentialSchedulerSvc::m_algname_vect
std::vector< std::string > m_algname_vect
Vector to bookkeep the information necessary to the index2name conversion.
Definition: ParallelSequentialSchedulerSvc.h:106
ParallelSequentialSchedulerSvc::m_controlFlow
concurrency::ExecutionFlowManager m_controlFlow
Definition: ParallelSequentialSchedulerSvc.h:103
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
ParallelSequentialSchedulerSvc::m_algResourcePool
SmartIF< IAlgResourcePool > m_algResourcePool
Cache for the algorithm resource pool.
Definition: ParallelSequentialSchedulerSvc.h:94
ParallelSequentialSchedulerSvc::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: ParallelSequentialSchedulerSvc.h:109
std::unordered_map::reserve
T reserve(T...args)
Algorithm::inputHandles
virtual std::vector< Gaudi::DataHandle * > inputHandles() const override
Definition: Algorithm.h:587
std::vector::emplace_back
T emplace_back(T...args)

StatusCode ParallelSequentialSchedulerSvc::popFinishedEvent | ( | EventContext *& | eventContext | ) |
| virtual

Blocks until an event is availble.

Get a finished event or block until one becomes available.

Definition at line 192 of file ParallelSequentialSchedulerSvc.cpp.

192 {
193
194 m_finishedEvents.pop(eventContext);
195 debug() << "Popped slot " << eventContext->slot() << "(event "
196 << eventContext->evt() << ")" << endmsg;
197 m_freeSlots++;
198 return StatusCode::SUCCESS;
199 }
EventContext::slot
ContextID_t slot() const
Definition: EventContext.h:41
ParallelSequentialSchedulerSvc::m_finishedEvents
tbb::concurrent_bounded_queue< EventContext * > m_finishedEvents
Queue of finished events.
Definition: ParallelSequentialSchedulerSvc.h:81
EventContext::evt
ContextEvt_t evt() const
Definition: EventContext.h:40
StatusCode::SUCCESS
Definition: StatusCode.h:30
ParallelSequentialSchedulerSvc::m_freeSlots
std::atomic_int m_freeSlots
Atomic to account for asyncronous updates by the scheduler wrt the rest.
Definition: ParallelSequentialSchedulerSvc.h:85
CommonMessagingBase::debug
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
Definition: CommonMessaging.h:127
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244

StatusCode ParallelSequentialSchedulerSvc::pushNewEvent | ( | EventContext * | eventContext | ) |
| virtual

Make an event available to the scheduler.

Immediately the algortihms are executed.

Definition at line 160 of file ParallelSequentialSchedulerSvc.cpp.

160 {
161 std::vector<EventContext*> eventContexts;
162 eventContexts.push_back(eventContext);
163 eventContext->setFail(false);
164 return pushNewEvents(eventContexts);
165 }
std::vector::push_back
T push_back(T...args)
ParallelSequentialSchedulerSvc::pushNewEvents
virtual StatusCode pushNewEvents(std::vector< EventContext * > &eventContexts)
Definition: ParallelSequentialSchedulerSvc.cpp:167
EventContext::setFail
void setFail(const bool &b=true)
Definition: EventContext.h:65
std::vector< EventContext * >

StatusCode ParallelSequentialSchedulerSvc::pushNewEvents | ( | std::vector< EventContext * > & | eventContexts | ) |
| virtual

Definition at line 167 of file ParallelSequentialSchedulerSvc.cpp.

167 {
168
169 for(auto evt : eventContexts){
170 if(m_freeSlots.load() > 0){
171 //only one thread executes scheduler --> m_freeSlots can only grow if other thread finishes
172 m_freeSlots--;
173
174 debug() << "Enqueuing event " << evt->evt() << " @ " << evt->slot() << endmsg;
175
176 tbb::task* t = new( tbb::task::allocate_root() )
177 SequentialTask(serviceLocator(), evt, this, m_algResourcePool);
178 tbb::task::enqueue( *t);
179 } else {
180 return StatusCode::FAILURE;
181 }
182 }
183
184 return StatusCode::SUCCESS;
185
186 }
Service::serviceLocator
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator.
Definition: Service.cpp:324
StatusCode::FAILURE
Definition: StatusCode.h:29
StatusCode::SUCCESS
Definition: StatusCode.h:30
read_lhcb_event_file.evt
tuple evt
Definition: read_lhcb_event_file.py:14
ParallelSequentialSchedulerSvc::m_freeSlots
std::atomic_int m_freeSlots
Atomic to account for asyncronous updates by the scheduler wrt the rest.
Definition: ParallelSequentialSchedulerSvc.h:85
CommonMessagingBase::debug
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
Definition: CommonMessaging.h:127
ParallelSequentialSchedulerSvc::SequentialTask
friend class SequentialTask
Definition: ParallelSequentialSchedulerSvc.h:112
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
ParallelSequentialSchedulerSvc::m_algResourcePool
SmartIF< IAlgResourcePool > m_algResourcePool
Cache for the algorithm resource pool.
Definition: ParallelSequentialSchedulerSvc.h:94

StatusCode ParallelSequentialSchedulerSvc::tryPopFinishedEvent | ( | EventContext *& | eventContext | ) |
| virtual

Try to fetch an event from the scheduler.

Try to get a finished event, if not available just return a failure.

Definition at line 205 of file ParallelSequentialSchedulerSvc.cpp.

205 {
206 if (m_finishedEvents.try_pop(eventContext)){
207 debug() << "Try Pop successful slot " << eventContext->slot()
208 << "(event " << eventContext->evt() << ")" << endmsg;
209 m_freeSlots++;
210 return StatusCode::SUCCESS;
211 }
212 return StatusCode::FAILURE;
213 }
EventContext::slot
ContextID_t slot() const
Definition: EventContext.h:41
ParallelSequentialSchedulerSvc::m_finishedEvents
tbb::concurrent_bounded_queue< EventContext * > m_finishedEvents
Queue of finished events.
Definition: ParallelSequentialSchedulerSvc.h:81
EventContext::evt
ContextEvt_t evt() const
Definition: EventContext.h:40
StatusCode::FAILURE
Definition: StatusCode.h:29
StatusCode::SUCCESS
Definition: StatusCode.h:30
ParallelSequentialSchedulerSvc::m_freeSlots
std::atomic_int m_freeSlots
Atomic to account for asyncronous updates by the scheduler wrt the rest.
Definition: ParallelSequentialSchedulerSvc.h:85
CommonMessagingBase::debug
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
Definition: CommonMessaging.h:127
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244

## Friends And Related Function Documentation

friend class SequentialTask
| friend

Definition at line 112 of file ParallelSequentialSchedulerSvc.h.

## Member Data Documentation

std::list<IAlgorithm*> ParallelSequentialSchedulerSvc::m_algList
| private

Cache the list of algs to be executed.

Definition at line 78 of file ParallelSequentialSchedulerSvc.h.

std::unordered_map<std::string,unsigned int> ParallelSequentialSchedulerSvc::m_algname_index_map
| private

Map to bookkeep the information necessary to the name2index conversion.

Definition at line 109 of file ParallelSequentialSchedulerSvc.h.

std::vector<std::string> ParallelSequentialSchedulerSvc::m_algname_vect
| private

Vector to bookkeep the information necessary to the index2name conversion.

Definition at line 106 of file ParallelSequentialSchedulerSvc.h.

SmartIF<IAlgResourcePool> ParallelSequentialSchedulerSvc::m_algResourcePool
| private

Cache for the algorithm resource pool.

Definition at line 94 of file ParallelSequentialSchedulerSvc.h.

concurrency::ExecutionFlowManager ParallelSequentialSchedulerSvc::m_controlFlow
| private

Definition at line 103 of file ParallelSequentialSchedulerSvc.h.

tbb::concurrent_bounded_queue<EventContext*> ParallelSequentialSchedulerSvc::m_finishedEvents
| private

Queue of finished events.

Definition at line 81 of file ParallelSequentialSchedulerSvc.h.

std::atomic_int ParallelSequentialSchedulerSvc::m_freeSlots
| private

Atomic to account for asyncronous updates by the scheduler wrt the rest.

Definition at line 85 of file ParallelSequentialSchedulerSvc.h.

std::unique_ptr<tbb::task_scheduler_init> ParallelSequentialSchedulerSvc::m_tbb_sched
| private

Definition at line 100 of file ParallelSequentialSchedulerSvc.h.

int ParallelSequentialSchedulerSvc::m_threadPoolSize
| private

Size of the threadpool initialised by TBB; a value of -1 gives TBB the freedom to choose.

Definition at line 97 of file ParallelSequentialSchedulerSvc.h.

bool ParallelSequentialSchedulerSvc::m_useTopAlgList
| private

Decide if the top alglist or its flat version has to be used.

Definition at line 75 of file ParallelSequentialSchedulerSvc.h.

SmartIF<IHiveWhiteBoard> ParallelSequentialSchedulerSvc::m_whiteboard
| private

A shortcut to the whiteboard.

Definition at line 88 of file ParallelSequentialSchedulerSvc.h.

std::string ParallelSequentialSchedulerSvc::m_whiteboardSvcName
| private

The whiteboard name.

Definition at line 91 of file ParallelSequentialSchedulerSvc.h.

The documentation for this class was generated from the following files:

- GaudiHive/src/ParallelSequentialSchedulerSvc.h
- GaudiHive/src/ParallelSequentialSchedulerSvc.cpp