| The Gaudi Framework v32r1 (f65d50dc)

EarlyTerminatingBranchesSharingAlgorithm.py
Go to the documentation of this file.
1 #!/usr/bin/env gaudirun.py
2 """Test a CF configuration with an algorithm shared between branches that can terminate early."""
3
4 from Gaudi.Configuration import *
5 from Configurables import HiveWhiteBoard, HiveSlimEventLoopMgr, AvalancheSchedulerSvc, AlgResourcePool
6 from Configurables import GaudiSequencer, CPUCruncher
7
8 # metaconfig
9 evtslots = 1
10 evtMax = 1
11 algosInFlight = 1
12
13 whiteboard = HiveWhiteBoard(
14 "EventDataSvc", EventSlots=evtslots, OutputLevel=INFO)
15
16 slimeventloopmgr = HiveSlimEventLoopMgr(
17 SchedulerName="AvalancheSchedulerSvc", OutputLevel=DEBUG)
18
19 AvalancheSchedulerSvc(ThreadPoolSize=algosInFlight, OutputLevel=DEBUG)
20
21
22 def parOR(name, subs=[]):
23 """ parallel OR sequencer """
24 seq = GaudiSequencer(name)
25 seq.ModeOR = True
26 seq.Sequential = False
27 seq.ShortCircuit = False
28 # seq.StopOverride = False
29 for s in subs:
30 seq.Members.append(s)
31 return seq
32
33
34 def seqAND(name, subs=[]):
35 """ sequential AND sequencer """
36 seq = GaudiSequencer(name)
37 seq.ModeOR = False
38 seq.Sequential = True
39 # seq.StopOverride = True
40 seq.ShortCircuit = True
41 for s in subs:
42 seq.Members.append(s)
43 return seq
44
45
46 topSequence = GaudiSequencer("topSequence")
47
48 and1A = seqAND("AND1A")
49
50 filterA = CPUCruncher("filterA")
51 and1A.Members.append(filterA)
52
53 and2A = seqAND("AND2A")
54 #and2A.StopOverride = True
55 and1A.Members.append(and2A)
56
57 orA = parOR("ORA")
58 and2A.Members.append(orA)
59
60 and3A = seqAND("AND3A")
61 #and3A.StopOverride = True
62 orA.Members.append(and3A)
63
64 alg1 = CPUCruncher("Alg1")
65 and3A.Members.append(alg1)
66
67 hypoA = CPUCruncher("hypoA")
68 and2A.Members.append(hypoA)
69
70
71 and1B = seqAND("AND1B")
72
73 filterB = CPUCruncher("filterB", InvertDecision=True)
74 and1B.Members.append(filterB)
75
76 and2B = seqAND("AND2B")
77 #and2B.StopOverride = True
78 and1B.Members.append(and2B)
79
80 orB = parOR("ORB")
81 and2B.Members.append(orB)
82
83 and3B = seqAND("AND3B")
84 #and3B.StopOverride = True
85 orB.Members.append(and3B)
86
87 alg2 = CPUCruncher("Alg2")
88 and3B.Members.append(alg1)
89
90 hypoB = CPUCruncher("hypoB")
91 and2B.Members.append(hypoB)
92
93
94
95 topSequence.Members.append(and1A)
96 topSequence.Members.append(and1B)
97
98 ApplicationMgr(
99 EvtMax=evtMax,
100 EvtSel='NONE',
101 ExtSvc=[whiteboard],
102 EventLoop=slimeventloopmgr,
103 TopAlg=[topSequence],
104 MessageSvcType="InertMessageSvc",
105 OutputLevel=INFO)
Gaudi.Configuration
Definition: Configuration.py:1
EarlyTerminatingBranchesSharingAlgorithm.seqAND
def seqAND(name, subs=[])
Definition: EarlyTerminatingBranchesSharingAlgorithm.py:34
ApplicationMgr
The Application Manager class.
Definition: ApplicationMgr.h:45
EarlyTerminatingBranchesSharingAlgorithm.parOR
def parOR(name, subs=[])
Definition: EarlyTerminatingBranchesSharingAlgorithm.py:22