The Gaudi Framework  v36r1 (3e2fb5a8)
ManySmallAlgs.py
Go to the documentation of this file.
1 #!/usr/bin/env gaudirun.py
2 
12 '''
13 A totally synthetic test of scheduler performance, with a large number of CF nodes and algorithms, but each algorithm does no work.
14 
15 In the flat mode (nested=False) 1000 algorithms are added directly to the base CF node as a baseline measurement.
16 
17 In nested mode the algorithms are grouped into sets of under a parent CF node.
18 Those nodes are then given 2 different CF node parents (20 in total) which include a prescale algorithm.
19 
20 In sequential mode (sequence=True) the prescale algorithms will randomly deactivate CF nodes at a frequency given by filterPass
21 '''
22 from Gaudi.Configuration import *
23 from Configurables import (HiveWhiteBoard, HiveSlimEventLoopMgr,
24  AvalancheSchedulerSvc, AlgResourcePool, Prescaler,
25  GaudiSequencer, Test__ViewTester)
26 
27 # metaconfig -------------------------------------------------------------------
28 # It's confortable to collect the relevant parameters at the top of the optionfile
29 evtslots = 5
30 evtMax = 1000
31 cardinality = 10
32 threads = 5
33 nested = True
34 sequence = True
35 filterPass = 50.0
36 
37 # -------------------------------------------------------------------------------
38 
39 # The configuration of the whiteboard ------------------------------------------
40 # It is useful to call it EventDataSvc to replace the usual data service with
41 # the whiteboard transparently.
42 
43 whiteboard = HiveWhiteBoard(
44  "EventDataSvc", EventSlots=evtslots, OutputLevel=FATAL)
45 
46 # -------------------------------------------------------------------------------
47 
48 # Event Loop Manager -----------------------------------------------------------
49 # It's called slim since it has less functionalities overall than the good-old
50 # event loop manager. Here we just set its outputlevel to DEBUG.
51 
52 slimeventloopmgr = HiveSlimEventLoopMgr(
53  SchedulerName="AvalancheSchedulerSvc", OutputLevel=INFO)
54 
55 # -------------------------------------------------------------------------------
56 
57 # ForwardScheduler -------------------------------------------------------------
58 # We just decide how many algorithms in flight we want to have and how many
59 # threads in the pool. The default value is -1, which is for TBB equivalent
60 # to take over the whole machine.
61 
62 scheduler = AvalancheSchedulerSvc(
63  ThreadPoolSize=threads,
64  ShowControlFlow=False,
65  ShowDataDependencies=False,
66  OutputLevel=INFO)
67 
68 # -------------------------------------------------------------------------------
69 
70 # Algo Resource Pool -----------------------------------------------------------
71 # Nothing special here, we just set the debug level.
72 AlgResourcePool(OutputLevel=FATAL)
73 
74 # -------------------------------------------------------------------------------
75 
76 # Flat structure
77 allAlgs = []
78 for i in range(1000):
79  alg = Prescaler("alg" + str(i))
80  alg.OutputLevel = FATAL
81  alg.Cardinality = cardinality
82  alg.PercentPass = 100.0
83  allAlgs.append(alg)
84 
85 baseSeq = GaudiSequencer(
86  "baseSeq",
87  Members=allAlgs,
88  Sequential=sequence,
89  ModeOR=True,
90  ShortCircuit=False,
91  OutputLevel=FATAL)
92 
93 # Nested structure
94 allSeqs = []
95 allSeqSeqs = []
96 if nested:
97  for i in range(100):
98  seqAlgs = allAlgs[10 * i:10 * (i + 1)]
99  seq = GaudiSequencer(
100  "seq" + str(i),
101  Members=seqAlgs,
102  Sequential=sequence,
103  ModeOR=False,
104  ShortCircuit=True,
105  OutputLevel=FATAL)
106  allSeqs.append(seq)
107 
108  for i in range(10):
109  seqSeqs = allSeqs[10 * i:10 * (i + 1)]
110 
111  filterAlg = Prescaler("filterAlg" + str(i))
112  filterAlg.OutputLevel = FATAL
113  filterAlg.Cardinality = cardinality
114  filterAlg.PercentPass = filterPass
115 
116  seq = GaudiSequencer(
117  "seqSeq" + str(i),
118  Members=[filterAlg] + seqSeqs,
119  Sequential=sequence,
120  ModeOR=False,
121  ShortCircuit=True,
122  OutputLevel=FATAL)
123  allSeqSeqs.append(seq)
124 
125  for i in range(9):
126  seqSeqs = allSeqs[5 + (10 * i):15 + (10 * i)]
127 
128  filterAlg = Prescaler("filterAlg" + str(i + 10))
129  filterAlg.OutputLevel = FATAL
130  filterAlg.Cardinality = cardinality
131  filterAlg.PercentPass = filterPass
132 
133  seq = GaudiSequencer(
134  "seqSeq" + str(i + 10),
135  Members=[filterAlg] + seqSeqs,
136  Sequential=sequence,
137  ModeOR=False,
138  ShortCircuit=True,
139  OutputLevel=FATAL)
140  allSeqSeqs.append(seq)
141 
142  baseSeq.Members = allSeqSeqs
143 
144 # Application Manager ----------------------------------------------------------
145 # We put everything together and change the type of message service
146 
148  EvtMax=evtMax,
149  EvtSel='NONE',
150  ExtSvc=[whiteboard],
151  EventLoop=slimeventloopmgr,
152  TopAlg=[baseSeq],
153  MessageSvcType="InertMessageSvc")
154 
155 # -------------------------------------------------------------------------------
Gaudi.Configuration
Definition: Configuration.py:1
ApplicationMgr
Definition: ApplicationMgr.h:57
Gaudi::Functional::details::zip::range
decltype(auto) range(Args &&... args)
Zips multiple containers together to form a single range.
Definition: FunctionalDetails.h:97