1 #ifndef GAUDIHIVE_AVALANCHESCHEDULERSVC_H 2 #define GAUDIHIVE_AVALANCHESCHEDULERSVC_H 25 #include <unordered_map> 29 #include "tbb/concurrent_queue.h" 106 using extends::extends;
136 this,
"ThreadPoolSize", -1,
137 "Size of the threadpool initialised by TBB; a value of -1 gives TBB the freedom to choose"};
141 "Maximum number of simultaneous I/O-bound algorithms"};
143 this,
"SimulateExecution",
false,
144 "Flag to perform single-pass simulation of execution flow before the actual execution"};
146 "The following modes are currently available: PCE, COD, DRE, E"};
148 "Dump intra-event concurrency dynamics to csv file"};
150 "Turn on preemptive way of scheduling of I/O-bound algorithms"};
155 "Attribute unmet input dependencies to this DataLoader Algorithm"};
160 "Show the INPUT and OUTPUT data dependencies of Algorithms"};
163 "Show the configuration of DataFlow between Algorithms"};
166 "Show the configuration of all Algorithms and Sequences"};
269 : m_closure( _closure ), m_scheduler( scheduler )
329 #endif // GAUDIHIVE_AVALANCHESCHEDULERSVC_H Gaudi::Property< bool > m_showDataFlow
StatusCode tryPopFinishedEvent(EventContext *&eventContext) override
Try to fetch an event from the scheduler.
Gaudi::Property< std::string > m_whiteboardSvcName
unsigned int m_IOBoundAlgosInFlight
Number of algoritms presently in flight.
SmartIF< IPrecedenceSvc > m_precSvc
A shortcut to the Precedence Service.
const std::string & name() const override
The identifying name of the algorithm object.
SmartIF< AvalancheSchedulerSvc > m_scheduler
Implementation of property with value of concrete type.
Gaudi::Property< bool > m_dumpIntraEventDynamics
Gaudi::Property< bool > m_showDataDeps
bool operator==(const SchedulerState &ss) const
StatusCode initialize() override
Initialise.
void dumpSchedulerState(int iSlot)
Dump the state of the scheduler.
StatusCode promoteToScheduled(unsigned int iAlgo, int si)
Algorithm promotion.
enqueueSchedulerActionTask(AvalancheSchedulerSvc *scheduler, std::function< StatusCode()> _closure)
StatusCode isStalled(int si)
Check if the scheduling is in a stall.
void activate()
Activate scheduler.
Gaudi::Property< std::string > m_useDataLoader
Gaudi::Property< std::string > m_optimizationMode
friend std::ostream & operator<<(std::ostream &os, const SchedulerState &ss)
StatusCode promoteToAsyncScheduled(unsigned int iAlgo, int si)
This class represents an entry point to all the event specific data.
unsigned int algname2index(const std::string &algoname)
Convert a name to an integer.
AlgsExecutionStates::State State
void addAlg(Algorithm *, EventContext *, pthread_t)
std::atomic< ActivationState > m_isActive
Flag to track if the scheduler is active or not.
std::unordered_map< std::string, unsigned int > m_algname_index_map
Map to bookkeep the information necessary to the name2index conversion.
Gaudi::Property< bool > m_checkDeps
Gaudi::Property< bool > m_useIOBoundAlgScheduler
bool operator<(const SchedulerState &rhs) const
std::atomic_int m_freeSlots
Atomic to account for asyncronous updates by the scheduler wrt the rest.
StatusCode pushNewEvents(std::vector< EventContext * > &eventContexts) override
unsigned int m_algosInFlight
Number of algoritms presently in flight.
static std::list< SchedulerState > m_sState
SmartIF< IAlgResourcePool > m_algResourcePool
Cache for the algorithm resource pool.
tbb::task * execute() override
StatusCode popFinishedEvent(EventContext *&eventContext) override
Blocks until an event is availble.
Gaudi::Property< bool > m_showControlFlow
This class is used for returning status codes from appropriate routines.
SmartIF< IHiveWhiteBoard > m_whiteboard
A shortcut to the whiteboard.
tbb::concurrent_bounded_queue< EventContext * > m_finishedEvents
Queue of finished events.
std::vector< std::string > m_algname_vect
Vector to bookkeep the information necessary to the index2name conversion.
SchedulerState(Algorithm *a, EventContext *e, pthread_t t)
Gaudi::Property< std::string > m_IOBoundAlgSchedulerSvcName
std::function< StatusCode()> action
StatusCode finalize() override
Finalise.
static std::mutex m_ssMut
~AvalancheSchedulerSvc() override=default
Destructor.
Gaudi::Property< int > m_threadPoolSize
SmartIF< IThreadPoolSvc > m_threadPoolSvc
SmartIF< IAccelerator > m_IOBoundAlgScheduler
A shortcut to IO-bound algorithm scheduler.
The IAlgorithm is the interface implemented by the Algorithm base class.
bool m_updateNeeded
Keep track of update actions scheduled.
Base class from which all concrete algorithm classes should be derived.
StatusCode promoteToFinished(unsigned int iAlgo, int si)
StatusCode pushNewEvent(EventContext *eventContext) override
Make an event available to the scheduler.
Gaudi::Property< bool > m_simulateExecution
Base class used to extend a class implementing other interfaces.
StatusCode eventFailed(EventContext *eventContext)
Method to check if an event failed and take appropriate actions.
Gaudi::Property< bool > m_enableCondSvc
const std::string & index2algname(unsigned int index)
Convert an integer to a name.
size_t m_maxAlgosInFlight
StatusCode promoteToExecuted(unsigned int iAlgo, int si, IAlgorithm *algo, EventContext *)
The call to this method is triggered only from within the AlgoExecutionTask.
std::function< StatusCode()> m_closure
SmartIF< ICondSvc > m_condSvc
A shortcut to service for Conditions handling.
unsigned int freeSlots() override
Get free slots number.
std::vector< EventSlot > m_eventSlots
Vector of events slots.
StatusCode promoteToAsyncExecuted(unsigned int iAlgo, int si, IAlgorithm *algo, EventContext *)
The call to this method is triggered only from within the IOBoundAlgTask.
bool operator==(Algorithm *a) const
StatusCode deactivate()
Deactivate scheduler.
void dumpState() override
StatusCode updateStates(int si=-1, const std::string &algo_name=std::string())
Loop on algorithm in the slots and promote them to successive states (-1 means all slots...
State
Execution states of the algorithms.
SmartIF< IAlgExecStateSvc > m_algExecStateSvc
Algorithm execution state manager.
Gaudi::Property< unsigned int > m_maxIOBoundAlgosInFlight
size_t m_maxEventsInFlight
tbb::concurrent_bounded_queue< action > m_actionsQueue
Queue where closures are stored and picked for execution.
std::thread m_thread
The thread in which the activate function runs.
StatusCode m_drain()
Drain the actions present in the queue.