All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
AtomicAlgSequencerTest.py
Go to the documentation of this file.
1 from Gaudi.Configuration import *
2 from Configurables import (HiveWhiteBoard, HiveSlimEventLoopMgr,
3  ForwardSchedulerSvc, AlgResourcePool,
4  CPUCruncher,
5  ContextEventCounterPtr,
6  ContextEventCounterData,
7  GaudiAtomicSequencer)
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 = ForwardSchedulerSvc(MaxAlgosInFlight = algosInFlight,
40  ThreadPoolSize = algosInFlight,
41  useGraphFlowManagement = True,
42  OutputLevel=DEBUG)
43 
44 #-------------------------------------------------------------------------------
45 
46 # Algo Resource Pool -----------------------------------------------------------
47 # Nothing special here, we just set the debug level.
48 AlgResourcePool(OutputLevel=DEBUG)
49 
50 #-------------------------------------------------------------------------------
51 
52 # Set up of the crunchers, daily business --------------------------------------
53 
54 a1 = CPUCruncher("A1")
55 a1.DataOutputs.output_0.Path = '/Event/a1'
56 
57 a2 = CPUCruncher("A2")
58 a2.DataInputs.input_0.Path = '/Skim/a1'
59 a2.DataInputs.input_0.AlternativePaths = ['/Event/a1']
60 a2.DataOutputs.output_0.Path = '/Event/a2'
61 
62 a3 = CPUCruncher("A3")
63 a3.DataInputs.input_0.Path = '/Event/a1'
64 a3.DataOutputs.output_0.Path = '/Event/a3'
65 
66 a4 = CPUCruncher("A4")
67 a4.DataInputs.input_0.Path = '/Event/a2'
68 a4.DataOutputs.output_0.Path = '/Event/a4'
69 
70 for algo in [a1, a2, a3, a4]:
71  algo.shortCalib=True
72  algo.OutputLevel=DEBUG
73  algo.varRuntime=.3
74  algo.avgRuntime=.5
75 
76 for algo in [a3]:
77  algo.Cardinality = cardinality
78 
79 seq = GaudiAtomicSequencer("CriticalSection",
80  Members=[a1,a2,a4],
81  OutputLevel=VERBOSE)
82 
83 # Application Manager ----------------------------------------------------------
84 # We put everything together and change the type of message service
85 
86 ApplicationMgr( EvtMax = evtMax,
87  EvtSel = 'NONE',
88  ExtSvc =[whiteboard],
89  EventLoop = slimeventloopmgr,
90  TopAlg = [seq, a3],
91  MessageSvcType="InertMessageSvc")
A class that implements a search for prime numbers.
Definition: CPUCruncher.h:19
Sequencer for executing several algorithms, stopping when one is faulty.
The SchedulerSvc implements the IScheduler interface.
The AlgResourcePool is a concrete implementation of the IAlgResourcePool interface.
Data service base class.
The Application Manager class.