1 #ifndef GAUDIHIVE_FORWARDSCHEDULERSVC_H 2 #define GAUDIHIVE_FORWARDSCHEDULERSVC_H 23 #include <unordered_map> 27 #include "tbb/concurrent_queue.h" 87 using extends::extends;
117 "Maximum number of event processed simultaneously"};
119 this,
"ThreadPoolSize", -1,
120 "Size of the threadpool initialised by TBB; a value of -1 gives TBB the freedom to choose"};
123 "[[deprecated]] Taken from the whiteboard"};
125 this,
"AlgosDependencies", {},
"[[deprecated]]"};
128 "Attribute unmet input dependencies to this DataLoader Algorithm"};
131 "Show the INPUT and OUTPUT data dependencies of Algorithms"};
133 "Show the configuration of DataFlow between Algorithms"};
135 "Show the configuration of all Algorithms and Sequences"};
225 : m_closure( _closure ), m_scheduler( scheduler )
288 #endif // GAUDIHIVE_FORWARDSCHEDULERSVC_H StatusCode deactivate()
Deactivate scheduler.
SchedulerState(Algorithm *a, EventContext *e, pthread_t t)
Gaudi::Property< bool > m_showControlFlow
StatusCode initialize() override
Initialise.
StatusCode eventFailed(EventContext *eventContext)
Method to check if an event failed and take appropriate actions.
SmartIF< IAlgResourcePool > m_algResourcePool
Cache for the algorithm resource pool.
const std::string & name() const override
The identifying name of the algorithm object.
Implementation of property with value of concrete type.
concurrency::recursive_CF::ExecutionFlowManager m_efManager
Member to take care of the control flow.
StatusCode isStalled(int si)
Check if the scheduling is in a stall.
StatusCode updateStates(int si=-1)
Loop on algorithm in the slots and promote them to successive states (-1 means all slots...
StatusCode finalize() override
Finalise.
SmartIF< IThreadPoolSvc > m_threadPoolSvc
AlgsExecutionStates::State State
Gaudi::Property< bool > m_checkDeps
The SchedulerSvc implements the IScheduler interface.
StatusCode pushNewEvent(EventContext *eventContext) override
Make an event available to the scheduler.
Gaudi::Property< std::vector< std::vector< std::string > > > m_algosDependencies
This class represents an entry point to all the event specific data.
SmartIF< IHiveWhiteBoard > m_whiteboard
A shortcut to the whiteboard.
StatusCode m_drain()
Drain the actions present in the queue.
std::function< StatusCode()> m_closure
Gaudi::Property< unsigned int > m_maxAlgosInFlight
enqueueSchedulerActionTask(ForwardSchedulerSvc *scheduler, std::function< StatusCode()> _closure)
SmartIF< ForwardSchedulerSvc > m_scheduler
std::atomic_int m_freeSlots
Atomic to account for asyncronous updates by the scheduler wrt the rest.
void addAlg(Algorithm *, EventContext *, pthread_t)
Gaudi::Property< bool > m_showDataFlow
unsigned int m_algosInFlight
Number of algoritms presently in flight.
tbb::concurrent_bounded_queue< EventContext * > m_finishedEvents
Queue of finished events.
std::thread m_thread
The thread in which the activate function runs.
bool operator<(const SchedulerState &rhs) const
std::vector< std::string > m_algname_vect
Vector to bookkeep the information necessary to the index2name conversion.
static std::list< SchedulerState > m_sState
Gaudi::Property< std::string > m_useDataLoader
std::vector< EventSlot > m_eventSlots
Vector of events slots.
StatusCode promoteToScheduled(unsigned int iAlgo, int si)
StatusCode promoteToFinished(unsigned int iAlgo, int si)
This class is used for returning status codes from appropriate routines.
bool operator==(Algorithm *a) const
Gaudi::Property< std::string > m_whiteboardSvcName
unsigned int algname2index(const std::string &algoname)
Convert a name to an integer.
tbb::task * execute() override
StatusCode promoteToExecuted(unsigned int iAlgo, int si, IAlgorithm *algo, EventContext *)
bool operator==(const SchedulerState &ss) const
~ForwardSchedulerSvc() override=default
Destructor.
unsigned int freeSlots() override
Get free slots number.
StatusCode pushNewEvents(std::vector< EventContext * > &eventContexts) override
Gaudi::Property< int > m_maxEventsInFlight
The IAlgorithm is the interface implemented by the Algorithm base class.
tbb::concurrent_bounded_queue< action > m_actionsQueue
Queue where closures are stored and picked for execution.
bool m_updateNeeded
Keep track of update actions scheduled.
concurrency::recursive_CF::ControlFlowGraph * m_efg
StatusCode tryPopFinishedEvent(EventContext *&eventContext) override
Try to fetch an event from the scheduler.
Base class from which all concrete algorithm classes should be derived.
std::unordered_map< std::string, unsigned int > m_algname_index_map
Map to bookkeep the information necessary to the name2index conversion.
void activate()
Activate scheduler.
Base class used to extend a class implementing other interfaces.
SmartIF< IAlgExecStateSvc > m_algExecStateSvc
Algorithm execution state manager.
StatusCode promoteToControlReady(unsigned int iAlgo, int si)
Algorithm promotion: Accepted by the control flow.
StatusCode popFinishedEvent(EventContext *&eventContext) override
Blocks until an event is availble.
void dumpSchedulerState(int iSlot)
Dump the state of the scheduler.
std::function< StatusCode()> action
static std::mutex m_ssMut
const std::string & index2algname(unsigned int index)
Convert an integer to a name.
friend std::ostream & operator<<(std::ostream &os, const SchedulerState &ss)
Gaudi::Property< bool > m_showDataDeps
std::atomic< ActivationState > m_isActive
Flag to track if the scheduler is active or not.
Manage control flow part of the execution flow.
State
Execution states of the algorithms.
Gaudi::Property< int > m_threadPoolSize
void dumpState() override
StatusCode promoteToDataReady(unsigned int iAlgo, int si)