The Gaudi Framework  v41r0 (bdbe7744)
Loading...
Searching...
No Matches
ControlFlowBranching+CrossBranchDataFlow.py
Go to the documentation of this file.
1#!/usr/bin/env gaudirun.py
2
12"""
13Typically, an EVTREJECTED algorithm is used to "short-circuit" the execution flow within
14the group of algorithms it belongs to. Within such early-terminated group, a false-negative
15data dependency resolution can never occur since all downstream algorithms are skipped.
16However, there might be other algorithms - outside of the early-terminated group - that depend
17on data outputs of the EVTREJECTED algorithm. The test emulates this scenario.
18"""
19
20from Configurables import (
21 AlgResourcePool,
22 AvalancheSchedulerSvc,
23 CPUCruncher,
24 CPUCrunchSvc,
25 Gaudi__Sequencer,
26 HiveSlimEventLoopMgr,
27 HiveWhiteBoard,
28)
29from Gaudi.Configuration import *
30
31# metaconfig
32evtslots = 1
33evtMax = 1
34algosInFlight = 1
35
36InertMessageSvc(OutputLevel=INFO)
37
38whiteboard = HiveWhiteBoard("EventDataSvc", EventSlots=evtslots, OutputLevel=INFO)
39
40slimeventloopmgr = HiveSlimEventLoopMgr(
41 SchedulerName="AvalancheSchedulerSvc", OutputLevel=DEBUG
42)
43
44AvalancheSchedulerSvc(ThreadPoolSize=algosInFlight, OutputLevel=DEBUG)
45
46AlgResourcePool(OutputLevel=DEBUG)
47
48CPUCrunchSvc(shortCalib=True)
49
50# Assemble data flow graph
51# algorithm that triggers an early exit from "Branch2"
52a1 = CPUCruncher("AlgA", InvertDecision=True)
53a1.outKeys = ["/Event/A"]
54
55a2 = CPUCruncher("AlgB")
56a2.inpKeys = ["/Event/A"]
57
58a3 = CPUCruncher("AlgC")
59a3.inpKeys = ["/Event/A"]
60
61for a in [a1, a2, a3]:
62 a.avgRuntime = 0.01
63
64# Assemble control flow graph
65branch1 = Gaudi__Sequencer("Branch1", ModeOR=False, ShortCircuit=False)
66branch2 = Gaudi__Sequencer("Branch2", ModeOR=False, ShortCircuit=True, Sequential=True)
67
68branch2.Members = [a1, a2]
69branch1.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)
The AlgResourcePool is a concrete implementation of the IAlgResourcePool interface.
The Application Manager class.
A class that implements a search for prime numbers.
Definition CPUCruncher.h:30
Data service base class.
Thread safe extension to the standard MessageSvc.