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