The Gaudi Framework  master (ff829712)
Loading...
Searching...
No Matches
SequentialAlgSequencerTest.py
Go to the documentation of this file.
11from Configurables import (
12 AlgResourcePool,
13 AvalancheSchedulerSvc,
14 CPUCruncher,
15 CPUCrunchSvc,
16 Gaudi__Sequencer,
17 HiveSlimEventLoopMgr,
18 HiveWhiteBoard,
19)
20from Gaudi.Configuration import *
21
22# metaconfig -------------------------------------------------------------------
23# It's confortable to collect the relevant parameters at the top of the optionfile
24evtslots = 5
25evtMax = 20
26cardinality = 5
27algosInFlight = 10
28# -------------------------------------------------------------------------------
29
30# The configuration of the whiteboard ------------------------------------------
31# It is useful to call it EventDataSvc to replace the usual data service with
32# the whiteboard transparently.
33
34whiteboard = HiveWhiteBoard("EventDataSvc", EventSlots=evtslots)
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
42slimeventloopmgr = HiveSlimEventLoopMgr(OutputLevel=DEBUG)
43
44# -------------------------------------------------------------------------------
45
46# Avalanche Scheduler ----------------------------------------------------------
47# We just decide how many algorithms in flight we want to have and how many
48# threads in the pool. The default value is -1, which is for TBB equivalent
49# to take over the whole machine.
50
51scheduler = AvalancheSchedulerSvc(ThreadPoolSize=algosInFlight, OutputLevel=DEBUG)
52
53# -------------------------------------------------------------------------------
54
55# Algo Resource Pool -----------------------------------------------------------
56# Nothing special here, we just set the debug level.
57AlgResourcePool(OutputLevel=DEBUG)
58
59CPUCrunchSvc(shortCalib=True)
60
61# -------------------------------------------------------------------------------
62
63# Set up of the crunchers, daily business --------------------------------------
64
65a1 = CPUCruncher("A1")
66a1.outKeys = ["/Event/a1"]
67
68a2 = CPUCruncher("A2")
69a2.inpKeys = ["/Event/a1"]
70a2.outKeys = ["/Event/a2"]
71
72a3 = CPUCruncher("A3")
73a3.inpKeys = ["/Event/a1"]
74a3.outKeys = ["/Event/a3"]
75
76a4 = CPUCruncher("A4")
77a4.inpKeys = ["/Event/a2"]
78a4.outKeys = ["/Event/a4"]
79
80for algo in [a1, a2, a3, a4]:
81 algo.OutputLevel = DEBUG
82 algo.varRuntime = 0.3
83 algo.avgRuntime = 0.5
84
85for algo in [a3]:
86 algo.Cardinality = cardinality
87
88seq = Gaudi__Sequencer(
89 "CriticalSection", Members=[a1, a2, a4], Sequential=True, OutputLevel=VERBOSE
90)
91
92# Application Manager ----------------------------------------------------------
93# We put everything together and change the type of message service
94
96 EvtMax=evtMax,
97 EvtSel="NONE",
98 ExtSvc=[whiteboard],
99 EventLoop=slimeventloopmgr,
100 TopAlg=[seq, a3],
101 MessageSvcType="InertMessageSvc",
102)
The AlgResourcePool is a concrete implementation of the IAlgResourcePool interface.
The Application Manager class.
A class that implements a search for prime numbers.
Definition CPUCruncher.h:30
Data service base class.