The Gaudi Framework  master (ff829712)
Loading...
Searching...
No Matches
BasicViewTest.py
Go to the documentation of this file.
1#!/usr/bin/env gaudirun.py
2
12"""
13A test for basic functionality of sub-event scheduling.
14Algorithms A2 and A3 should run twice per event, in sub-event contexts.
15
16The ViewTester is an algorithm specifically designed to create sub-event
17contexts, pass them to the scheduler, and report on the current context.
18
19Four instances of ViewTester are used as follows:
20 - Algorithm A1 creates two sub-event contexts
21 - Algorithms A2 and A3 run within the sub-event contexts
22 - Algorithm A4 runs in the whole event context, after the sub-events
23
24"""
25
26from Configurables import (
27 AlgResourcePool,
28 AvalancheSchedulerSvc,
29 CPUCruncher,
30 Gaudi__Sequencer,
31 HiveSlimEventLoopMgr,
32 HiveWhiteBoard,
33 Test__ViewTester,
34)
35from Gaudi.Configuration import *
36
37# metaconfig -------------------------------------------------------------------
38# It's confortable to collect the relevant parameters at the top of the optionfile
39evtslots = 1
40evtMax = 10
41cardinality = 1
42threads = 1
43viewsPerEvt = 2
44# -------------------------------------------------------------------------------
45
46# The configuration of the whiteboard ------------------------------------------
47# It is useful to call it EventDataSvc to replace the usual data service with
48# the whiteboard transparently.
49
50whiteboard = HiveWhiteBoard("EventDataSvc", EventSlots=evtslots)
51
52# -------------------------------------------------------------------------------
53
54# Event Loop Manager -----------------------------------------------------------
55# It's called slim since it has less functionalities overall than the good-old
56# event loop manager. Here we just set its outputlevel to DEBUG.
57
58slimeventloopmgr = HiveSlimEventLoopMgr(
59 SchedulerName="AvalancheSchedulerSvc", OutputLevel=INFO
60)
61
62# -------------------------------------------------------------------------------
63
64# ForwardScheduler -------------------------------------------------------------
65# We just decide how many algorithms in flight we want to have and how many
66# threads in the pool. The default value is -1, which is for TBB equivalent
67# to take over the whole machine.
68
69scheduler = AvalancheSchedulerSvc(ThreadPoolSize=threads, OutputLevel=INFO)
70
71# -------------------------------------------------------------------------------
72
73# Algo Resource Pool -----------------------------------------------------------
74# Nothing special here, we just set the debug level.
75AlgResourcePool(OutputLevel=INFO)
76
77# -------------------------------------------------------------------------------
78
79# Set up of the crunchers, daily business --------------------------------------
80
81a1 = Test__ViewTester("A1")
82a1.baseViewName = "view"
83a1.viewNumber = viewsPerEvt
84a1.viewNodeName = "viewNode"
85
86a2 = Test__ViewTester("A2")
87a2.viewNodeName = ""
88
89a3 = Test__ViewTester("A3")
90a3.viewNodeName = ""
91
92a4 = Test__ViewTester("A4")
93a4.viewNodeName = ""
94
95for algo in [a1, a2, a3, a4]:
96 algo.Cardinality = cardinality
97 algo.OutputLevel = INFO
98
99viewNode = Gaudi__Sequencer(
100 "viewNode", Members=[a2, a3], Sequential=False, ShortCircuit=False, OutputLevel=INFO
101)
102
103createViewSeq = Gaudi__Sequencer(
104 "createViewSeq", Members=[a1, viewNode, a4], Sequential=True, OutputLevel=INFO
105)
106
107# Application Manager ----------------------------------------------------------
108# We put everything together and change the type of message service
109
111 EvtMax=evtMax,
112 EvtSel="NONE",
113 ExtSvc=[whiteboard],
114 EventLoop=slimeventloopmgr,
115 TopAlg=[createViewSeq],
116 MessageSvcType="InertMessageSvc",
117)
118
119# -------------------------------------------------------------------------------
The AlgResourcePool is a concrete implementation of the IAlgResourcePool interface.
The Application Manager class.
Data service base class.