11 #ifndef GAUDIHIVE_AVALANCHESCHEDULERSVC_H 12 #define GAUDIHIVE_AVALANCHESCHEDULERSVC_H 35 #include <unordered_map> 39 #include "tbb/concurrent_priority_queue.h" 40 #include "tbb/concurrent_queue.h" 117 using extends::extends;
154 this,
"ThreadPoolSize", -1,
155 "Size of the threadpool initialised by TBB; a value of -1 gives TBB the freedom to choose"};
159 "Maximum number of simultaneous I/O-bound algorithms"};
161 this,
"SimulateExecution",
false,
162 "Flag to perform single-pass simulation of execution flow before the actual execution"};
164 "The following modes are currently available: PCE, COD, DRE, E"};
166 "Dump intra-event concurrency dynamics to csv file"};
168 "Turn on preemptive way of scheduling of I/O-bound algorithms"};
173 "Attribute unmet input dependencies to this DataLoader Algorithm"};
178 "Show the INPUT and OUTPUT data dependencies of Algorithms"};
181 "Show the configuration of DataFlow between Algorithms"};
184 "Show the configuration of all Algorithms and Sequences"};
307 #endif // GAUDIHIVE_AVALANCHESCHEDULERSVC_H Gaudi::Property< bool > m_showDataFlow
bool isStalled(const EventSlot &) const
Check if scheduling in a particular slot is in a stall.
EventContext * contextPtr
StatusCode tryPopFinishedEvent(EventContext *&eventContext) override
Try to fetch an event from the scheduler.
virtual StatusCode scheduleEventView(const EventContext *sourceContext, const std::string &nodeName, std::unique_ptr< EventContext > viewContext) override
Method to inform the scheduler about event views.
Class representing an event slot.
Gaudi::Property< std::string > m_whiteboardSvcName
unsigned int m_IOBoundAlgosInFlight
Number of algorithms presently in flight.
SmartIF< IPrecedenceSvc > m_precSvc
A shortcut to the Precedence Service.
Implementation of property with value of concrete type.
Gaudi::Property< bool > m_dumpIntraEventDynamics
const std::string & index2algname(unsigned int index)
Convert an integer to a name.
Gaudi::Property< bool > m_showDataDeps
std::atomic< bool > m_needsUpdate
StatusCode initialize() override
Initialise.
void dumpSchedulerState(int iSlot)
Dump the state of the scheduler.
void activate()
Activate scheduler.
Gaudi::Property< std::string > m_useDataLoader
Gaudi::Property< std::string > m_optimizationMode
Struct to hold entries in the alg queues.
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.
bool operator()(const AlgQueueEntry &i, const AlgQueueEntry &j) const
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.
Comparison operator to sort the queues.
Gaudi::Property< bool > m_checkDeps
Gaudi::Property< bool > m_useIOBoundAlgScheduler
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 algorithms presently in flight.
Gaudi::Property< bool > m_verboseSubSlots
SmartIF< IAlgResourcePool > m_algResourcePool
Cache for the algorithm resource pool.
StatusCode popFinishedEvent(EventContext *&eventContext) override
Blocks until an event is available.
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.
Gaudi::Property< std::string > m_IOBoundAlgSchedulerSvcName
StatusCode finalize() override
Finalise.
~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.
State
Execution states of the algorithms.
StatusCode promoteToAsyncScheduled(unsigned int iAlgo, int si, EventContext *)
StatusCode promoteToFinished(unsigned int iAlgo, int si)
StatusCode pushNewEvent(EventContext *eventContext) override
Make an event available to the scheduler.
Gaudi::Property< bool > m_simulateExecution
StatusCode setAlgState(unsigned int iAlgo, EventContext *contextPtr, AState state, bool iterate=false)
Base class used to extend a class implementing other interfaces.
StatusCode updateStates()
Loop on algorithm in the slots and promote them to successive states.
Gaudi::Property< bool > m_enableCondSvc
size_t m_maxAlgosInFlight
StatusCode enqueue(unsigned int iAlgo, int si, EventContext *)
Algorithm promotion.
SmartIF< ICondSvc > m_condSvc
A shortcut to service for Conditions handling.
void eventFailed(EventContext *eventContext)
Method to execute if an event failed.
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.
StatusCode deactivate()
Deactivate scheduler.
tbb::concurrent_priority_queue< AlgQueueEntry, AlgQueueSort > m_scheduledQueue
Queues for scheduled algorithms.
std::queue< AlgQueueEntry > m_retryQueue
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.
StatusCode promoteToExecuted(unsigned int iAlgo, int si, EventContext *)
The call to this method is triggered only from within the AlgoExecutionTask.
std::thread m_thread
The thread in which the activate function runs.