3 This script acts as a wrapper in order to generate Gaudi configs for running 4 with different parameters in order to perform performance measurements. 5 It takes command line arguments. 11 NumberOfEventsInFlight = 5 12 NumberOfAlgosInFlight = 5 20 usage =
"%prog [options]" 21 parser = optparse.OptionParser(usage)
22 parser.add_option(
'-n', help=
'Number of events', dest=
'nevts', default=15)
23 parser.add_option(
'--eif', help=
'Events in flight', dest=
'eif', default=5)
24 parser.add_option(
'--aif', help=
'Algos in flight', dest=
'aif', default=10)
26 '--nthreads', help=
'Number of threads', dest=
'nthreads', default=10)
40 '-v', help=
'Verbosity level', dest=
'verbosity', default=5)
43 help=
'ExecuteWorkflow',
49 help=
'Launch in background',
54 '--scale', help=
'Scale Algorithms time', dest=
'scale', default=1)
55 options, args = parser.parse_args()
59 def replaceValues(cfg_name, n, eif, aif, nthreads, scale, clone, dumpQueues,
62 newcfglines = open(cfg_name,
"r").readlines() 63 cfg_name = cfg_name.replace(".py",
"")
66 verb =
"_v%s" % verbosity
69 scale_s =
"_s%s" % scale
70 newcfgname =
"measurement_%s_n%s_eif%s_aif%s_nthreads%s_c%s_dq%s%s%s.py" % (
71 cfg_name, n, eif, aif, nthreads, clone, dumpQueues, scale_s, verb)
72 newcfg = open(newcfgname,
"w")
73 for line
in newcfglines:
74 if (
'NumberOfEvents' in line
and 'NUMBEROFEVENTS' in line
75 and not "FLIGHT" in line):
76 line = line.replace(
"NUMBEROFEVENTS", str(n))
77 if (
'NumberOfEventsInFlight' in line
78 and 'NUMBEROFEVENTSINFLIGHT' in line):
79 line = line.replace(
"NUMBEROFEVENTSINFLIGHT", str(eif))
80 if (
'NumberOfAlgosInFlight' in line
81 and 'NUMBEROFALGOSINFLIGHT' in line):
82 line = line.replace(
"NUMBEROFALGOSINFLIGHT", str(aif))
83 if (
'NumberOfThreads' in line
and 'NUMBEROFTHREADS' in line):
84 line = line.replace(
"NUMBEROFTHREADS", str(nthreads))
85 if (
'DumpQueues' in line
and 'DUMPQUEUES' in line):
86 line = line.replace(
"DUMPQUEUES", str(dumpQueues))
87 if (
'CloneAlgos' in line
and 'CLONEALGOS' in line):
88 line = line.replace(
"CLONEALGOS", str(clone))
89 if (
'Verbosity' in line
and 'VERBOSITY' in line):
90 line = line.replace(
"VERBOSITY", str(verbosity))
91 if (
'Scale' in line
and 'SCALE' in line):
92 line = line.replace(
"SCALE", str(scale))
98 if __name__ ==
"__main__":
101 options.eif, options.aif, options.nthreads,
102 float(options.scale), options.clone,
103 options.dumpqueues, options.verbosity)
105 logfile = newcfg.replace(
".py",
".log")
106 gaudirun =
"`alias gaudirun`" 107 gaudirun =
"/afs/cern.ch/user/d/dpiparo/Gaudi/build.x86_64-slc5-gcc46-opt/run gaudirun.py" 108 command =
"/usr/bin/time -f %%S -o timing_%s %s %s >& %s " % (
109 logfile, gaudirun, newcfg, logfile)
114 if options.execbrunel:
def replaceValues(cfg_name, n, eif, aif, nthreads, scale, clone, dumpQueues, verbosity)