11 #ifndef GAUDIHIVE_AVALANCHESCHEDULERSVC_H 12 #define GAUDIHIVE_AVALANCHESCHEDULERSVC_H 34 #include <string_view> 36 #include <unordered_map> 40 #include "tbb/concurrent_priority_queue.h" 41 #include "tbb/concurrent_queue.h" 120 using extends::extends;
157 this,
"ThreadPoolSize", -1,
158 "Size of the global thread pool initialised by TBB; a value of -1 requests to use" 159 "all available hardware threads; -100 requests to bypass TBB executing " 160 "all algorithms in the scheduler's thread."};
163 this,
"MaxBlockingAlgosInFlight", 0,
"Maximum allowed number of simultaneously running CPU-blocking algorithms"};
165 this,
"SimulateExecution",
false,
166 "Flag to perform single-pass simulation of execution flow before the actual execution"};
168 "The following modes are currently available: PCE, COD, DRE, E"};
170 "Dump intra-event concurrency dynamics to csv file"};
172 this,
"PreemptiveBlockingTasks",
false,
173 "Enable preemptive scheduling of CPU-blocking algorithms. Blocking algorithms must be flagged accordingly."};
178 "Attribute unmet input dependencies to this DataLoader Algorithm"};
183 "Show the INPUT and OUTPUT data dependencies of Algorithms"};
186 "Show the configuration of DataFlow between Algorithms"};
189 "Show the configuration of all Algorithms and Sequences"};
328 #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.
StatusCode tryPopFinishedEvent(EventContext *&eventContext) override
Try to fetch an event from the scheduler.
Struct to hold entries in the alg queues.
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
SmartIF< IPrecedenceSvc > m_precSvc
A shortcut to the Precedence Service.
TaskSpec(IAlgorithm *algPtr, unsigned int algIndex, const std::string &algName, unsigned int algRank, bool blocking, int slotIndex, EventContext *eventContext)
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::queue< TaskSpec > m_retryQueue
std::atomic< bool > m_needsUpdate
StatusCode initialize() override
Initialise.
void dumpSchedulerState(int iSlot)
Dump the state of the scheduler.
void activate()
Activate scheduler.
EventContext * contextPtr
Gaudi::Property< std::string > m_useDataLoader
Gaudi::Property< std::string > m_optimizationMode
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.
StatusCode signoff(const TaskSpec &)
The call to this method is triggered only from within the AlgTask.
StatusCode revise(unsigned int iAlgo, EventContext *contextPtr, AState state, bool iterate=false)
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
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.
StatusCode schedule(TaskSpec &&)
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.
StatusCode finalize() override
Finalise.
~AvalancheSchedulerSvc() override=default
Destructor.
Gaudi::Property< int > m_threadPoolSize
SmartIF< IThreadPoolSvc > m_threadPoolSvc
The IAlgorithm is the interface implemented by the Algorithm base class.
State
Execution states of the algorithms.
Gaudi::Property< bool > m_enablePreemptiveBlockingTasks
StatusCode pushNewEvent(EventContext *eventContext) override
Make an event available to the scheduler.
StatusCode iterate()
Loop on all slots to schedule DATAREADY algorithms and sign off ready events.
Gaudi::Property< bool > m_simulateExecution
tbb::concurrent_priority_queue< TaskSpec, AlgQueueSort > m_scheduledQueue
Queues for scheduled algorithms.
Base class used to extend a class implementing other interfaces.
unsigned int m_blockingAlgosInFlight
Number of algorithms presently in flight.
Gaudi::Property< bool > m_enableCondSvc
size_t m_maxAlgosInFlight
SmartIF< ICondSvc > m_condSvc
A shortcut to service for Conditions handling.
void eventFailed(EventContext *eventContext)
Method to execute if an event failed.
TaskSpec & operator=(const TaskSpec &)=delete
Assignment operator.
unsigned int freeSlots() override
Get free slots number.
std::vector< EventSlot > m_eventSlots
Vector of events slots.
StatusCode deactivate()
Deactivate scheduler.
Gaudi::Property< unsigned int > m_maxBlockingAlgosInFlight
TaskSpec()
Default constructor.
bool operator()(const TaskSpec &i, const TaskSpec &j) const
SmartIF< IAlgExecStateSvc > m_algExecStateSvc
Algorithm execution state manager.
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.