The Gaudi Framework  master (37c0b60a)
SequentialAlgSequencerTest.py
Go to the documentation of this file.
1 
11 from Configurables import (
12  AlgResourcePool,
13  AvalancheSchedulerSvc,
14  CPUCruncher,
15  CPUCrunchSvc,
16  Gaudi__Sequencer,
17  HiveSlimEventLoopMgr,
18  HiveWhiteBoard,
19 )
20 from Gaudi.Configuration import *
21 
22 # metaconfig -------------------------------------------------------------------
23 # It's confortable to collect the relevant parameters at the top of the optionfile
24 evtslots = 5
25 evtMax = 20
26 cardinality = 5
27 algosInFlight = 10
28 # -------------------------------------------------------------------------------
29 
30 # The configuration of the whiteboard ------------------------------------------
31 # It is useful to call it EventDataSvc to replace the usual data service with
32 # the whiteboard transparently.
33 
34 whiteboard = HiveWhiteBoard("EventDataSvc", EventSlots=evtslots)
35 
36 # -------------------------------------------------------------------------------
37 
38 # Event Loop Manager -----------------------------------------------------------
39 # It's called slim since it has less functionalities overall than the good-old
40 # event loop manager. Here we just set its outputlevel to DEBUG.
41 
42 slimeventloopmgr = HiveSlimEventLoopMgr(OutputLevel=DEBUG)
43 
44 # -------------------------------------------------------------------------------
45 
46 # Avalanche Scheduler ----------------------------------------------------------
47 # We just decide how many algorithms in flight we want to have and how many
48 # threads in the pool. The default value is -1, which is for TBB equivalent
49 # to take over the whole machine.
50 
51 scheduler = AvalancheSchedulerSvc(ThreadPoolSize=algosInFlight, OutputLevel=DEBUG)
52 
53 # -------------------------------------------------------------------------------
54 
55 # Algo Resource Pool -----------------------------------------------------------
56 # Nothing special here, we just set the debug level.
57 AlgResourcePool(OutputLevel=DEBUG)
58 
59 CPUCrunchSvc(shortCalib=True)
60 
61 # -------------------------------------------------------------------------------
62 
63 # Set up of the crunchers, daily business --------------------------------------
64 
65 a1 = CPUCruncher("A1")
66 a1.outKeys = ["/Event/a1"]
67 
68 a2 = CPUCruncher("A2")
69 a2.inpKeys = ["/Event/a1"]
70 a2.outKeys = ["/Event/a2"]
71 
72 a3 = CPUCruncher("A3")
73 a3.inpKeys = ["/Event/a1"]
74 a3.outKeys = ["/Event/a3"]
75 
76 a4 = CPUCruncher("A4")
77 a4.inpKeys = ["/Event/a2"]
78 a4.outKeys = ["/Event/a4"]
79 
80 for algo in [a1, a2, a3, a4]:
81  algo.OutputLevel = DEBUG
82  algo.varRuntime = 0.3
83  algo.avgRuntime = 0.5
84 
85 for algo in [a3]:
86  algo.Cardinality = cardinality
87 
88 seq = Gaudi__Sequencer(
89  "CriticalSection", Members=[a1, a2, a4], Sequential=True, OutputLevel=VERBOSE
90 )
91 
92 # Application Manager ----------------------------------------------------------
93 # We put everything together and change the type of message service
94 
96  EvtMax=evtMax,
97  EvtSel="NONE",
98  ExtSvc=[whiteboard],
99  EventLoop=slimeventloopmgr,
100  TopAlg=[seq, a3],
101  MessageSvcType="InertMessageSvc",
102 )
Gaudi.Configuration
Definition: Configuration.py:1
ApplicationMgr
Definition: ApplicationMgr.h:57