| The Gaudi Framework v28r2-patches (bc4ad17a)

- 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, outputLevel=INFO)
def | get (self)

## Public Attributes
| timeValue
| IOboolValue
| sleepFraction
| cfg
| dfg
| 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 114 of file precedence.py.

## Constructor & Destructor Documentation

def GaudiHive.precedence.CruncherSequence.__init__ | ( |  | self,
|  |  | timeValue,
|  |  | IOboolValue,
|  |  | sleepFraction,
|  |  | cfgPath,
|  |  | dfgPath,
|  |  | topSequencer,
|  |  | showStat = `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 125 of file precedence.py.

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

## 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 172 of file precedence.py.

172 def _declare_data_deps(self, algo_name, algo):
173 """ Declare data inputs and outputs for a given algorithm. """
174
175 # Declare data inputs
176 for inNode, outNode in self.dfg.in_edges(algo_name):
177 dataName = inNode
178 if dataName not in self.unique_data_objects:
179 self.unique_data_objects.append(dataName)
180
181 if dataName not in algo.inpKeys: algo.inpKeys.append(dataName)
182
183 # Declare data outputs
184 for inNode, outNode in self.dfg.out_edges(algo_name):
185 dataName = outNode
186 if dataName not in self.unique_data_objects:
187 self.unique_data_objects.append(dataName)
188
189 if dataName not in algo.outKeys: algo.outKeys.append(dataName)
190
191
GaudiHive.precedence.CruncherSequence.unique_data_objects
list unique_data_objects
Definition: precedence.py:123
GaudiHive.precedence.CruncherSequence._declare_data_deps
def _declare_data_deps(self, algo_name, algo)
Definition: precedence.py:172

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

    Assemble the tree of sequencers.

Definition at line 192 of file precedence.py.

192 def _generate_sequence(self, name, seq=None):
193 """ Assemble the tree of sequencers. """
194
195 if not seq:
196 seq = GaudiSequencer(name, ShortCircuit = False)
197
198 for n in self.cfg[name]:
199 if '/' in n:
200 algo_type, algo_name = n.split('/')
201 else:
202 algo_type = 'GaudiAlgorithm'
203 algo_name = n
204
205 if algo_type in ['GaudiSequencer', 'AthSequencer', 'ProcessPhase']:
206 if algo_name in ['RecoITSeq','RecoOTSeq','RecoTTSeq']: continue
207
208 if n not in self.unique_sequencers:
209 self.unique_sequencers.append(n)
210 else:
211 if n not in self.dupl_seqs: self.dupl_seqs[n] = 2
212 else: self.dupl_seqs[n] += 1
213
214 seq_daughter=GaudiSequencer(algo_name, OutputLevel=INFO )
215 if self.cfg.node[n].get('ModeOR') == 'True':
216 self.OR_sequencers.append(n)
217 seq_daughter.ModeOR = True
218 #if self.cfg.node[n].get('Lazy') == 'False':
219 # print "Non-Lazy - ", n
220 seq_daughter.ShortCircuit = False
221 if seq_daughter not in seq.Members:
222 seq.Members += [seq_daughter]
223 # iterate deeper
224 self._generate_sequence(n,seq_daughter)
225 else:
226 #rndname = ''.join(random.choice(string.lowercase) for i in range(5))
227 #if algo_name in unique_algos: algo_name = algo_name + "-" + rndname
228 if n not in self.unique_algos:
229 self.unique_algos.append(n)
230 else:
231 if n not in self.dupl_algos: self.dupl_algos[n] = 2
232 else: self.dupl_algos[n] += 1
233
234 avgRuntime, varRuntime = self.timeValue.get(algo_name)
235 algo_daughter = CPUCruncher(algo_name,
236 OutputLevel = self.outputLevel,
237 shortCalib = True,
238 varRuntime = varRuntime,
239 avgRuntime = avgRuntime,
240 SleepFraction = self.sleepFraction if self.IOboolValue.get() else 0.)
241
242 self._declare_data_deps(algo_name, algo_daughter)
243
244 if algo_daughter not in seq.Members:
245 seq.Members += [algo_daughter]
246
247 return seq
248
GaudiHive.precedence.CruncherSequence._generate_sequence
def _generate_sequence(self, name, seq=None)
Definition: precedence.py:192
GaudiHive.precedence.CruncherSequence.get
def get(self)
Definition: precedence.py:168
GaudiHive.precedence.CruncherSequence.unique_algos
list unique_algos
Definition: precedence.py:120
GaudiHive.precedence.CruncherSequence.cfg
cfg
Definition: precedence.py:139
GaudiHive.precedence.CruncherSequence.unique_sequencers
list unique_sequencers
Definition: precedence.py:117
GaudiHive.precedence.CruncherSequence.outputLevel
outputLevel
Definition: precedence.py:142
GaudiHive.precedence.CruncherSequence.dupl_seqs
dictionary dupl_seqs
Definition: precedence.py:118
GaudiHive.precedence.CruncherSequence.dupl_algos
dictionary dupl_algos
Definition: precedence.py:121
GaudiHive.precedence.CruncherSequence._declare_data_deps
def _declare_data_deps(self, algo_name, algo)
Definition: precedence.py:172
GaudiHive.precedence.CruncherSequence.sleepFraction
sleepFraction
Definition: precedence.py:137

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

Definition at line 168 of file precedence.py.

168 def get(self):
169
170 return self.sequencer
171
GaudiHive.precedence.CruncherSequence.get
def get(self)
Definition: precedence.py:168
GaudiHive.precedence.CruncherSequence.sequencer
sequencer
Definition: precedence.py:145

## Member Data Documentation

GaudiHive.precedence.CruncherSequence.cfg

Definition at line 139 of file precedence.py.

GaudiHive.precedence.CruncherSequence.dfg

Definition at line 140 of file precedence.py.

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

Definition at line 121 of file precedence.py.

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

Definition at line 118 of file precedence.py.

GaudiHive.precedence.CruncherSequence.IOboolValue

Definition at line 136 of file precedence.py.

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

Definition at line 119 of file precedence.py.

GaudiHive.precedence.CruncherSequence.outputLevel

Definition at line 142 of file precedence.py.

GaudiHive.precedence.CruncherSequence.sequencer

Definition at line 145 of file precedence.py.

GaudiHive.precedence.CruncherSequence.sleepFraction

Definition at line 137 of file precedence.py.

GaudiHive.precedence.CruncherSequence.timeValue

Definition at line 135 of file precedence.py.

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

Definition at line 120 of file precedence.py.

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

Definition at line 123 of file precedence.py.

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

Definition at line 117 of file precedence.py.

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

- GaudiHive/python/GaudiHive/precedence.py