The Gaudi Framework  master (37c0b60a)
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 Configurables import (
15  AvalancheSchedulerSvc,
16  CPUCruncher,
17  Gaudi__Sequencer,
18  HiveSlimEventLoopMgr,
19  HiveWhiteBoard,
20 )
21 from Gaudi.Configuration import *
22 
23 # metaconfig
24 evtslots = 1
25 evtMax = 1
26 algosInFlight = 1
27 
28 whiteboard = HiveWhiteBoard("EventDataSvc", EventSlots=evtslots, OutputLevel=INFO)
29 
30 slimeventloopmgr = HiveSlimEventLoopMgr(
31  SchedulerName="AvalancheSchedulerSvc", OutputLevel=DEBUG
32 )
33 
34 AvalancheSchedulerSvc(ThreadPoolSize=algosInFlight, OutputLevel=DEBUG)
35 
36 
37 def parOR(name, subs=[]):
38  """parallel OR sequencer"""
39  seq = Gaudi__Sequencer(name)
40  seq.ModeOR = True
41  seq.Sequential = False
42  seq.ShortCircuit = False
43  # seq.StopOverride = False
44  for s in subs:
45  seq.Members.append(s)
46  return seq
47 
48 
49 def seqAND(name, subs=[]):
50  """sequential AND sequencer"""
51  seq = Gaudi__Sequencer(name)
52  seq.ModeOR = False
53  seq.Sequential = True
54  # seq.StopOverride = True
55  seq.ShortCircuit = True
56  for s in subs:
57  seq.Members.append(s)
58  return seq
59 
60 
61 topSequence = Gaudi__Sequencer("topSequence")
62 
63 and1A = seqAND("AND1A")
64 
65 filterA = CPUCruncher("filterA")
66 and1A.Members.append(filterA)
67 
68 and2A = seqAND("AND2A")
69 # and2A.StopOverride = True
70 and1A.Members.append(and2A)
71 
72 orA = parOR("ORA")
73 and2A.Members.append(orA)
74 
75 and3A = seqAND("AND3A")
76 # and3A.StopOverride = True
77 orA.Members.append(and3A)
78 
79 alg1 = CPUCruncher("Alg1")
80 and3A.Members.append(alg1)
81 
82 hypoA = CPUCruncher("hypoA")
83 and2A.Members.append(hypoA)
84 
85 
86 and1B = seqAND("AND1B")
87 
88 filterB = CPUCruncher("filterB", InvertDecision=True)
89 and1B.Members.append(filterB)
90 
91 and2B = seqAND("AND2B")
92 # and2B.StopOverride = True
93 and1B.Members.append(and2B)
94 
95 orB = parOR("ORB")
96 and2B.Members.append(orB)
97 
98 and3B = seqAND("AND3B")
99 # and3B.StopOverride = True
100 orB.Members.append(and3B)
101 
102 alg2 = CPUCruncher("Alg2")
103 and3B.Members.append(alg1)
104 
105 hypoB = CPUCruncher("hypoB")
106 and2B.Members.append(hypoB)
107 
108 
109 
110 topSequence.Members.append(and1A)
111 topSequence.Members.append(and1B)
112 
114  EvtMax=evtMax,
115  EvtSel="NONE",
116  ExtSvc=[whiteboard],
117  EventLoop=slimeventloopmgr,
118  TopAlg=[topSequence],
119  MessageSvcType="InertMessageSvc",
120  OutputLevel=INFO,
121 )
Gaudi.Configuration
Definition: Configuration.py:1
EarlyTerminatingBranchesSharingAlgorithm.parOR
def parOR(name, subs=[])
Definition: EarlyTerminatingBranchesSharingAlgorithm.py:37
ApplicationMgr
Definition: ApplicationMgr.h:57
EarlyTerminatingBranchesSharingAlgorithm.seqAND
def seqAND(name, subs=[])
Definition: EarlyTerminatingBranchesSharingAlgorithm.py:49