| The Gaudi Framework v32r1 (f65d50dc)

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