The Gaudi Framework  v36r6 (b1ee9983)
ControlFlowBranching+CrossBranchDataFlow.py
Go to the documentation of this file.
1 #!/usr/bin/env gaudirun.py
2 
12 """
13 Typically, an EVTREJECTED algorithm is used to "short-circuit" the execution flow within
14 the group of algorithms it belongs to. Within such early-terminated group, a false-negative
15 data dependency resolution can never occur since all downstream algorithms are skipped.
16 However, there might be other algorithms - outside of the early-terminated group - that depend
17 on data outputs of the EVTREJECTED algorithm. The test emulates this scenario.
18 """
19 
20 from Configurables import (
21  AlgResourcePool,
22  AvalancheSchedulerSvc,
23  CPUCruncher,
24  CPUCrunchSvc,
25  GaudiSequencer,
26  HiveSlimEventLoopMgr,
27  HiveWhiteBoard,
28 )
29 from Gaudi.Configuration import *
30 
31 # metaconfig
32 evtslots = 1
33 evtMax = 1
34 algosInFlight = 1
35 
36 InertMessageSvc(OutputLevel=INFO)
37 
38 whiteboard = HiveWhiteBoard("EventDataSvc", EventSlots=evtslots, OutputLevel=INFO)
39 
40 slimeventloopmgr = HiveSlimEventLoopMgr(
41  SchedulerName="AvalancheSchedulerSvc", OutputLevel=DEBUG
42 )
43 
44 AvalancheSchedulerSvc(ThreadPoolSize=algosInFlight, OutputLevel=DEBUG)
45 
46 AlgResourcePool(OutputLevel=DEBUG)
47 
48 CPUCrunchSvc(shortCalib=True)
49 
50 # Assemble data flow graph
51 # algorithm that triggers an early exit from "Branch2"
52 a1 = CPUCruncher("AlgA", InvertDecision=True)
53 a1.outKeys = ["/Event/A"]
54 
55 a2 = CPUCruncher("AlgB")
56 a2.inpKeys = ["/Event/A"]
57 
58 a3 = CPUCruncher("AlgC")
59 a3.inpKeys = ["/Event/A"]
60 
61 for a in [a1, a2, a3]:
62  a.avgRuntime = 0.01
63 
64 # Assemble control flow graph
65 branch1 = GaudiSequencer("Branch1", ModeOR=False, ShortCircuit=False)
66 branch2 = GaudiSequencer("Branch2", ModeOR=False, ShortCircuit=True, Sequential=True)
67 
68 branch2.Members = [a1, a2]
69 branch1.Members = [branch2, a3]
70 
72  EvtMax=evtMax,
73  EvtSel="NONE",
74  ExtSvc=[whiteboard],
75  EventLoop=slimeventloopmgr,
76  TopAlg=[branch1],
77  MessageSvcType="InertMessageSvc",
78  OutputLevel=INFO,
79 )
InertMessageSvc
Definition: InertMessageSvc.h:36
Gaudi.Configuration
Definition: Configuration.py:1
ApplicationMgr
Definition: ApplicationMgr.h:57