The Gaudi Framework  v32r2 (46d42edc)
brunelWrapper Namespace Reference

Functions

def createParser ()
 
def replaceValues (cfg_name, n, eif, aif, nthreads, scale, clone, dumpQueues, verbosity)
 

Variables

def options = createParser()
 
def newcfg
 
def logfile = newcfg.replace(".py", ".log")
 
string gaudirun = "`alias gaudirun`"
 
string command
 

Detailed Description

This script acts as a wrapper in order to generate Gaudi configs for running
with different parameters in order to perform performance measurements.
It takes command line arguments.

Function Documentation

◆ createParser()

def brunelWrapper.createParser ( )

Definition at line 20 of file brunelWrapper.py.

20 def createParser():
21  usage = "%prog [options]"
22  parser = optparse.OptionParser(usage)
23  parser.add_option('-n', help='Number of events', dest='nevts', default=15)
24  parser.add_option('--eif', help='Events in flight', dest='eif', default=5)
25  parser.add_option('--aif', help='Algos in flight', dest='aif', default=10)
26  parser.add_option(
27  '--nthreads', help='Number of threads', dest='nthreads', default=10)
28  parser.add_option(
29  '--clone',
30  help='Clone Algos',
31  dest='clone',
32  action='store_true',
33  default=False)
34  parser.add_option(
35  '--dumpQueues',
36  help='Dump Queues',
37  dest='dumpqueues',
38  action='store_true',
39  default=False)
40  parser.add_option(
41  '-v', help='Verbosity level', dest='verbosity', default=5)
42  parser.add_option(
43  '--exec',
44  help='ExecuteWorkflow',
45  dest='execbrunel',
46  action='store_true',
47  default=False)
48  parser.add_option(
49  '--bg',
50  help='Launch in background',
51  dest='bg',
52  action='store_true',
53  default=False)
54  parser.add_option(
55  '--scale', help='Scale Algorithms time', dest='scale', default=1)
56  options, args = parser.parse_args()
57  return options
58 
59 
def createParser()

◆ replaceValues()

def brunelWrapper.replaceValues (   cfg_name,
  n,
  eif,
  aif,
  nthreads,
  scale,
  clone,
  dumpQueues,
  verbosity 
)

Definition at line 60 of file brunelWrapper.py.

60 def replaceValues(cfg_name, n, eif, aif, nthreads, scale, clone, dumpQueues,
61  verbosity):
62 
63  newcfglines = open(cfg_name, "r").readlines()
64  cfg_name = cfg_name.replace(".py", "")
65  verb = ""
66  if verbosity != 6:
67  verb = "_v%s" % verbosity
68  scale_s = ""
69  if scale != 1:
70  scale_s = "_s%s" % scale
71  newcfgname = "measurement_%s_n%s_eif%s_aif%s_nthreads%s_c%s_dq%s%s%s.py" % (
72  cfg_name, n, eif, aif, nthreads, clone, dumpQueues, scale_s, verb)
73  newcfg = open(newcfgname, "w")
74  for line in newcfglines:
75  if ('NumberOfEvents' in line and 'NUMBEROFEVENTS' in line
76  and not "FLIGHT" in line):
77  line = line.replace("NUMBEROFEVENTS", str(n))
78  if ('NumberOfEventsInFlight' in line
79  and 'NUMBEROFEVENTSINFLIGHT' in line):
80  line = line.replace("NUMBEROFEVENTSINFLIGHT", str(eif))
81  if ('NumberOfAlgosInFlight' in line
82  and 'NUMBEROFALGOSINFLIGHT' in line):
83  line = line.replace("NUMBEROFALGOSINFLIGHT", str(aif))
84  if ('NumberOfThreads' in line and 'NUMBEROFTHREADS' in line):
85  line = line.replace("NUMBEROFTHREADS", str(nthreads))
86  if ('DumpQueues' in line and 'DUMPQUEUES' in line):
87  line = line.replace("DUMPQUEUES", str(dumpQueues))
88  if ('CloneAlgos' in line and 'CLONEALGOS' in line):
89  line = line.replace("CLONEALGOS", str(clone))
90  if ('Verbosity' in line and 'VERBOSITY' in line):
91  line = line.replace("VERBOSITY", str(verbosity))
92  if ('Scale' in line and 'SCALE' in line):
93  line = line.replace("SCALE", str(scale))
94  newcfg.write(line)
95  newcfg.close()
96  return newcfgname
97 
98 
def replaceValues(cfg_name, n, eif, aif, nthreads, scale, clone, dumpQueues, verbosity)

Variable Documentation

◆ command

string brunelWrapper.command
Initial value:
1 = "/usr/bin/time -f %%S -o timing_%s %s %s >& %s " % (
2  logfile, gaudirun, newcfg, logfile)

Definition at line 109 of file brunelWrapper.py.

◆ gaudirun

string brunelWrapper.gaudirun = "`alias gaudirun`"

Definition at line 107 of file brunelWrapper.py.

◆ logfile

def brunelWrapper.logfile = newcfg.replace(".py", ".log")

Definition at line 106 of file brunelWrapper.py.

◆ newcfg

def brunelWrapper.newcfg
Initial value:
1 = replaceValues("BrunelScenario.py", options.nevts,
2  options.eif, options.aif, options.nthreads,
3  float(options.scale), options.clone,
4  options.dumpqueues, options.verbosity)
def replaceValues(cfg_name, n, eif, aif, nthreads, scale, clone, dumpQueues, verbosity)

Definition at line 101 of file brunelWrapper.py.

◆ options

def brunelWrapper.options = createParser()

Definition at line 100 of file brunelWrapper.py.