| The Gaudi Framework v29r0 (ff2e7097)

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Public Attributes | Static Public Attributes | Private Member Functions | List of all members
GaudiHive.precedence.CruncherSequence Class Reference
Inheritance diagram for GaudiHive.precedence.CruncherSequence:
[legend]
Collaboration diagram for GaudiHive.precedence.CruncherSequence:
[legend]

## Public Member Functions
def | __init__ (self, timeValue, IOboolValue, sleepFraction, cfgPath, dfgPath, topSequencer, showStat=False, timeline=False, outputLevel=INFO)
def | get (self)

## Public Attributes
| timeValue
| IOboolValue
| sleepFraction
| cfg
| dfg
| enableTimeline
| outputLevel
| sequencer

## Static Public Attributes
list | unique_sequencers = []
dictionary | dupl_seqs = {}
list | OR_sequencers = []
list | unique_algos = []
dictionary | dupl_algos = {}
list | unique_data_objects = []

## Private Member Functions
def | _declare_data_deps (self, algo_name, algo)
def | _generate_sequence (self, name, seq=None)

## Detailed Description

    Constructs the sequence tree of CPUCrunchers with provided control flow and data flow precedence rules.

Definition at line 124 of file precedence.py.

## Constructor & Destructor Documentation

def GaudiHive.precedence.CruncherSequence.__init__ | ( |  | self,
|  |  | timeValue,
|  |  | IOboolValue,
|  |  | sleepFraction,
|  |  | cfgPath,
|  |  | dfgPath,
|  |  | topSequencer,
|  |  | showStat = `False`,
|  |  | timeline = `False`,
|  |  | outputLevel = `INFO`
| ) |  |

    Keyword arguments:
    timeValue -- timeValue object to set algorithm execution time
    IOboolValue -- *BooleanValue object to set whether an algorithm has to experience IO-bound execution
    cfgPath -- relative to $GAUDIHIVEROOT/data path to GRAPHML file with control flow dependencies
    dfgPath -- relative to $GAUDIHIVEROOT/data path to GRAPHML file with data flow dependencies
    showStat -- print out statistics on precedence graph

Definition at line 136 of file precedence.py.

136 showStat=False, timeline=False, outputLevel=INFO):
137 """
138 Keyword arguments:
139 timeValue -- timeValue object to set algorithm execution time
140 IOboolValue -- *BooleanValue object to set whether an algorithm has to experience IO-bound execution
141 cfgPath -- relative to $GAUDIHIVEROOT/data path to GRAPHML file with control flow dependencies
142 dfgPath -- relative to $GAUDIHIVEROOT/data path to GRAPHML file with data flow dependencies
143 showStat -- print out statistics on precedence graph
144 """
145
146 self.timeValue = timeValue
147 self.IOboolValue = IOboolValue
148 self.sleepFraction = sleepFraction
149
150 self.cfg = nx.read_graphml(_buildFilePath(cfgPath))
151 self.dfg = nx.read_graphml(_buildFilePath(dfgPath))
152
153 self.enableTimeline = timeline
154
155 self.outputLevel = outputLevel
156
157 # Generate control flow part
158 self.sequencer = self._generate_sequence(topSequencer)
159
160 if showStat:
161 import pprint
162
163 print "\n===== Statistics on Algorithms ====="
164 print "Total number of algorithm nodes: ", len(self.unique_algos) + sum([self.dupl_algos[i] - 1 for i in self.dupl_algos])
165 print "Number of unique algorithms: ", len(self.unique_algos)
166 print " -->", len(self.dupl_algos), "of them being re-used with the following distribution: ", [self.dupl_algos[i] for i in self.dupl_algos]
167 # pprint.pprint(dupl_algos)
168
169 print "\n===== Statistics on Sequencers ====="
170 print "Total number of sequencers: ", len(self.unique_sequencers) + sum([self.dupl_seqs[i] - 1 for i in self.dupl_seqs])
171 print "Number of unique sequencers: ", len(self.unique_sequencers)
172 print " -->", len(self.dupl_seqs), "of them being re-used with the following distribution: ", [self.dupl_seqs[i] for i in self.dupl_seqs]
173 # pprint.pprint(dupl_seqs)
174 print "Number of OR-sequencers: ", len(self.OR_sequencers)
175
176 print "\n===== Statistics on DataObjects ====="
177 print "Number of unique DataObjects: ", len(self.unique_data_objects)
178 # pprint.pprint(self.unique_data_objects)
179 print
180
GaudiHive.precedence.CruncherSequence._generate_sequence
def _generate_sequence(self, name, seq=None)
Definition: precedence.py:206
GaudiHive.precedence.CruncherSequence.timeValue
timeValue
Definition: precedence.py:146
GaudiHive.precedence.CruncherSequence.OR_sequencers
list OR_sequencers
Definition: precedence.py:129
sum
double sum(double x, double y, double z)
Definition: 3DoubleFuncTest.cpp:25
GaudiHive.precedence.CruncherSequence.enableTimeline
enableTimeline
Definition: precedence.py:153
GaudiHive.precedence.CruncherSequence.unique_data_objects
list unique_data_objects
Definition: precedence.py:133
GaudiHive.precedence.CruncherSequence.unique_algos
list unique_algos
Definition: precedence.py:130
GaudiHive.precedence.CruncherSequence.cfg
cfg
Definition: precedence.py:150
GaudiHive.precedence.CruncherSequence.dfg
dfg
Definition: precedence.py:151
GaudiHive.precedence.CruncherSequence.IOboolValue
IOboolValue
Definition: precedence.py:147
GaudiHive.precedence.CruncherSequence.unique_sequencers
list unique_sequencers
Definition: precedence.py:127
GaudiHive.precedence.CruncherSequence.outputLevel
outputLevel
Definition: precedence.py:155
GaudiHive.precedence.CruncherSequence.dupl_seqs
dictionary dupl_seqs
Definition: precedence.py:128
GaudiHive.precedence.CruncherSequence.sequencer
sequencer
Definition: precedence.py:158
GaudiHive.precedence.CruncherSequence.dupl_algos
dictionary dupl_algos
Definition: precedence.py:131
GaudiHive.precedence._buildFilePath
def _buildFilePath(filePath)
Definition: precedence.py:12
GaudiHive.precedence.CruncherSequence.sleepFraction
sleepFraction
Definition: precedence.py:148

## Member Function Documentation

def GaudiHive.precedence.CruncherSequence._declare_data_deps | ( |  | self,
|  |  | algo_name,
|  |  | algo
| ) |  |
| private

    Declare data inputs and outputs for a given algorithm.

Definition at line 185 of file precedence.py.

185 def _declare_data_deps(self, algo_name, algo):
186 """ Declare data inputs and outputs for a given algorithm. """
187
188 # Declare data inputs
189 for inNode, outNode in self.dfg.in_edges(algo_name):
190 dataName = inNode
191 if dataName not in self.unique_data_objects:
192 self.unique_data_objects.append(dataName)
193
194 if dataName not in algo.inpKeys:
195 algo.inpKeys.append(dataName)
196
197 # Declare data outputs
198 for inNode, outNode in self.dfg.out_edges(algo_name):
199 dataName = outNode
200 if dataName not in self.unique_data_objects:
201 self.unique_data_objects.append(dataName)
202
203 if dataName not in algo.outKeys:
204 algo.outKeys.append(dataName)
205
GaudiHive.precedence.CruncherSequence.unique_data_objects
list unique_data_objects
Definition: precedence.py:133
GaudiHive.precedence.CruncherSequence._declare_data_deps
def _declare_data_deps(self, algo_name, algo)
Definition: precedence.py:185

def GaudiHive.precedence.CruncherSequence._generate_sequence | ( |  | self,
|  |  | name,
|  |  | seq = `None`
| ) |  |
| private

    Assemble the tree of sequencers.

Definition at line 206 of file precedence.py.

206 def _generate_sequence(self, name, seq=None):
207 """ Assemble the tree of sequencers. """
208
209 if not seq:
210 seq = GaudiSequencer(name, ShortCircuit=False)
211
212 for n in self.cfg[name]:
213 if '/' in n:
214 algo_type, algo_name = n.split('/')
215 else:
216 algo_type = 'GaudiAlgorithm'
217 algo_name = n
218
219 if algo_type in ['GaudiSequencer', 'AthSequencer', 'ProcessPhase']:
220 if algo_name in ['RecoITSeq', 'RecoOTSeq', 'RecoTTSeq']:
221 continue
222
223 if n not in self.unique_sequencers:
224 self.unique_sequencers.append(n)
225 else:
226 if n not in self.dupl_seqs:
227 self.dupl_seqs[n] = 2
228 else:
229 self.dupl_seqs[n] += 1
230
231 seq_daughter = GaudiSequencer(algo_name, OutputLevel=INFO)
232 if self.cfg.node[n].get('ModeOR') == 'True':
233 self.OR_sequencers.append(n)
234 seq_daughter.ModeOR = True
235 # if self.cfg.node[n].get('Lazy') == 'False':
236 # print "Non-Lazy - ", n
237 seq_daughter.ShortCircuit = False
238 if seq_daughter not in seq.Members:
239 seq.Members += [seq_daughter]
240 # iterate deeper
241 self._generate_sequence(n, seq_daughter)
242 else:
243 #rndname = ''.join(random.choice(string.lowercase) for i in range(5))
244 #if algo_name in unique_algos: algo_name = algo_name + "-" + rndname
245 if n not in self.unique_algos:
246 self.unique_algos.append(n)
247 else:
248 if n not in self.dupl_algos:
249 self.dupl_algos[n] = 2
250 else:
251 self.dupl_algos[n] += 1
252
253 avgRuntime, varRuntime = self.timeValue.get(algo_name)
254 algo_daughter = CPUCruncher(algo_name,
255 OutputLevel=self.outputLevel,
256 shortCalib=True,
257 varRuntime=varRuntime,
258 avgRuntime=avgRuntime,
259 SleepFraction=self.sleepFraction if self.IOboolValue.get() else 0.,
260 Timeline=self.enableTimeline)
261
262 self._declare_data_deps(algo_name, algo_daughter)
263
264 if algo_daughter not in seq.Members:
265 seq.Members += [algo_daughter]
266
267 return seq
268
GaudiHive.precedence.CruncherSequence._generate_sequence
def _generate_sequence(self, name, seq=None)
Definition: precedence.py:206
GaudiHive.precedence.CruncherSequence.get
def get(self)
Definition: precedence.py:181
GaudiHive.precedence.CruncherSequence.enableTimeline
enableTimeline
Definition: precedence.py:153
GaudiHive.precedence.CruncherSequence.unique_algos
list unique_algos
Definition: precedence.py:130
GaudiHive.precedence.CruncherSequence.cfg
cfg
Definition: precedence.py:150
GaudiHive.precedence.CruncherSequence.unique_sequencers
list unique_sequencers
Definition: precedence.py:127
GaudiHive.precedence.CruncherSequence.outputLevel
outputLevel
Definition: precedence.py:155
GaudiHive.precedence.CruncherSequence.dupl_seqs
dictionary dupl_seqs
Definition: precedence.py:128
GaudiHive.precedence.CruncherSequence.dupl_algos
dictionary dupl_algos
Definition: precedence.py:131
GaudiHive.precedence.CruncherSequence._declare_data_deps
def _declare_data_deps(self, algo_name, algo)
Definition: precedence.py:185
GaudiHive.precedence.CruncherSequence.sleepFraction
sleepFraction
Definition: precedence.py:148

def GaudiHive.precedence.CruncherSequence.get | ( |  | self | ) |

Definition at line 181 of file precedence.py.

181 def get(self):
182
183 return self.sequencer
184
GaudiHive.precedence.CruncherSequence.get
def get(self)
Definition: precedence.py:181
GaudiHive.precedence.CruncherSequence.sequencer
sequencer
Definition: precedence.py:158

## Member Data Documentation

GaudiHive.precedence.CruncherSequence.cfg

Definition at line 150 of file precedence.py.

GaudiHive.precedence.CruncherSequence.dfg

Definition at line 151 of file precedence.py.

dictionary GaudiHive.precedence.CruncherSequence.dupl_algos = {}
| static

Definition at line 131 of file precedence.py.

dictionary GaudiHive.precedence.CruncherSequence.dupl_seqs = {}
| static

Definition at line 128 of file precedence.py.

GaudiHive.precedence.CruncherSequence.enableTimeline

Definition at line 153 of file precedence.py.

GaudiHive.precedence.CruncherSequence.IOboolValue

Definition at line 147 of file precedence.py.

list GaudiHive.precedence.CruncherSequence.OR_sequencers = []
| static

Definition at line 129 of file precedence.py.

GaudiHive.precedence.CruncherSequence.outputLevel

Definition at line 155 of file precedence.py.

GaudiHive.precedence.CruncherSequence.sequencer

Definition at line 158 of file precedence.py.

GaudiHive.precedence.CruncherSequence.sleepFraction

Definition at line 148 of file precedence.py.

GaudiHive.precedence.CruncherSequence.timeValue

Definition at line 146 of file precedence.py.

list GaudiHive.precedence.CruncherSequence.unique_algos = []
| static

Definition at line 130 of file precedence.py.

list GaudiHive.precedence.CruncherSequence.unique_data_objects = []
| static

Definition at line 133 of file precedence.py.

list GaudiHive.precedence.CruncherSequence.unique_sequencers = []
| static

Definition at line 127 of file precedence.py.

The documentation for this class was generated from the following file:

- GaudiHive/python/GaudiHive/precedence.py