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