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