| The Gaudi Framework v28r2-patches (bc4ad17a)

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

SequentialAlgSequencerTest.py
Go to the documentation of this file.
1 from Gaudi.Configuration import *
2 from Configurables import (HiveWhiteBoard, HiveSlimEventLoopMgr,
3 AvalancheSchedulerSvc, AlgResourcePool,
4 CPUCruncher,
5 ContextEventCounterPtr,
6 ContextEventCounterData,
7 GaudiSequencer)
8
9 # metaconfig -------------------------------------------------------------------
10 # It's confortable to collect the relevant parameters at the top of the optionfile
11 evtslots = 5
12 evtMax = 20
13 cardinality=5
14 algosInFlight=10
15 #-------------------------------------------------------------------------------
16
17 # The configuration of the whiteboard ------------------------------------------
18 # It is useful to call it EventDataSvc to replace the usual data service with
19 # the whiteboard transparently.
20
21 whiteboard = HiveWhiteBoard("EventDataSvc",
22 EventSlots = evtslots)
23
24 #-------------------------------------------------------------------------------
25
26 # Event Loop Manager -----------------------------------------------------------
27 # It's called slim since it has less functionalities overall than the good-old
28 # event loop manager. Here we just set its outputlevel to DEBUG.
29
30 slimeventloopmgr = HiveSlimEventLoopMgr(OutputLevel=DEBUG)
31
32 #-------------------------------------------------------------------------------
33
34 # ForwardScheduler -------------------------------------------------------------
35 # We just decide how many algorithms in flight we want to have and how many
36 # threads in the pool. The default value is -1, which is for TBB equivalent
37 # to take over the whole machine.
38
39 scheduler = AvalancheSchedulerSvc(MaxAlgosInFlight = algosInFlight,
40 ThreadPoolSize = algosInFlight,
41 OutputLevel=DEBUG)
42
43 #-------------------------------------------------------------------------------
44
45 # Algo Resource Pool -----------------------------------------------------------
46 # Nothing special here, we just set the debug level.
47 AlgResourcePool(OutputLevel=DEBUG)
48
49 #-------------------------------------------------------------------------------
50
51 # Set up of the crunchers, daily business --------------------------------------
52
53 a1 = CPUCruncher("A1")
54 a1.outKeys = ['/Event/a1']
55
56 a2 = CPUCruncher("A2")
57 a2.inpKeys = ['/Event/a1']
58 a2.outKeys = ['/Event/a2']
59
60 a3 = CPUCruncher("A3")
61 a3.inpKeys = ['/Event/a1']
62 a3.outKeys = ['/Event/a3']
63
64 a4 = CPUCruncher("A4")
65 a4.inpKeys = ['/Event/a2']
66 a4.outKeys = ['/Event/a4']
67
68 for algo in [a1, a2, a3, a4]:
69 algo.shortCalib=True
70 algo.OutputLevel=DEBUG
71 algo.varRuntime=.3
72 algo.avgRuntime=.5
73
74 for algo in [a3]:
75 algo.Cardinality = cardinality
76
77 seq = GaudiSequencer("CriticalSection",
78 Members=[a1,a2,a4],
79 Sequential=True,
80 OutputLevel=VERBOSE)
81
82 # Application Manager ----------------------------------------------------------
83 # We put everything together and change the type of message service
84
85 ApplicationMgr( EvtMax = evtMax,
86 EvtSel = 'NONE',
87 ExtSvc =[whiteboard],
88 EventLoop = slimeventloopmgr,
89 TopAlg = [seq, a3],
90 MessageSvcType="InertMessageSvc")
CPUCruncher
A class that implements a search for prime numbers.
Definition: CPUCruncher.h:19
GaudiSequencer
Sequencer for executing several algorithms, stopping when one is faulty.
Definition: GaudiSequencer.h:26
HiveSlimEventLoopMgr
Definition: HiveSlimEventLoopMgr.h:26
Gaudi.Configuration
Definition: Configuration.py:1
AlgResourcePool
The AlgResourcePool is a concrete implementation of the IAlgResourcePool interface.
Definition: AlgResourcePool.h:31
HiveWhiteBoard
Data service base class.
Definition: HiveWhiteBoard.cpp:95
AvalancheSchedulerSvc
Introduction
Definition: AvalancheSchedulerSvc.h:100
ApplicationMgr
The Application Manager class.
Definition: ApplicationMgr.h:47