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