13 Reference optionfile which shows in a simple way how to take advantage of the
14 Gaudi components desicated to concurrency.
16 o HiveWhiteBoard: a convenient way to collect several TES (one per "processing
17 slot"), accessible in a thread safe way, keeps a catalogue of the products
18 written on each processing slot. The number of slots in the whiteboard
19 determines also the number of events processed simultaneously by the scheduler.
20 o AvalancheSchedulerSvc: state machine of the algorithms interfaced with the
21 TBB runtime. It is responsible for the submission of the algorithms. An
22 algorithm is marked ready for submission when its needed input is available.
23 It deals the asynchronous termination of algorithms with a "receiver" thread
24 and a thread safe queue.
25 o HiveSlimEventLoopMgr: an event factory. Pushes new events and pops finished
26 events to/from the scheduler. It does not manage algorithms/streams.
27 o AlgResourcePool: Service managing the creation of algorithms (through the
28 algorithm manager), including clones. It also manages the algorithms according
29 to the resources they need (parameter NeededResources - vector of strings - of
31 o InertMessageSvc: as the TBBMsgSvc, it manages the printing of the messages in
32 a multithreaded environment.
34 The CPUCruncher is not a component dealing with concurrency, but a useful
35 entity to test it. It's an algorithm that simply wastes cpu.
39 from Configurables
import (
41 AvalancheSchedulerSvc,
42 ContextEventCounterData,
43 ContextEventCounterPtr,
63 whiteboard = HiveWhiteBoard(
"EventDataSvc", EventSlots=evtslots)
71 slimeventloopmgr = HiveSlimEventLoopMgr(
72 SchedulerName=
"AvalancheSchedulerSvc", OutputLevel=DEBUG
82 scheduler = AvalancheSchedulerSvc(ThreadPoolSize=threads, OutputLevel=WARNING)
88 AlgResourcePool(OutputLevel=DEBUG)
90 CPUCrunchSvc(shortCalib=
True)
96 a1 = CPUCruncher(
"A1")
97 a1.outKeys = [
"/Event/a1"]
99 a2 = CPUCruncher(
"A2")
100 a2.inpKeys = [
"/Event/a1"]
101 a2.outKeys = [
"/Event/a2"]
103 a3 = CPUCruncher(
"A3")
104 a3.inpKeys = [
"/Event/a1"]
105 a3.outKeys = [
"/Event/a3"]
107 a4 = CPUCruncher(
"A4")
108 a4.inpKeys = [
"/Event/a2",
"/Event/a3"]
109 a4.outKeys = [
"/Event/a4"]
111 for algo
in [a1, a2, a3, a4]:
112 algo.Cardinality = cardinality
113 algo.OutputLevel = WARNING
114 algo.varRuntime = 0.3
115 algo.avgRuntime = 0.5
117 ctrp = ContextEventCounterPtr(
"CNT*", Cardinality=0, OutputLevel=INFO)
118 ctrd = ContextEventCounterData(
"CNT&", Cardinality=0, OutputLevel=INFO)
127 EventLoop=slimeventloopmgr,
128 TopAlg=[a1, a2, a3, a4, ctrp, ctrd],
129 MessageSvcType=
"InertMessageSvc",