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