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