13 This script acts as a wrapper in order to generate Gaudi configs for running
14 with different parameters in order to perform performance measurements.
15 It takes command line arguments.
17 from __future__
import print_function
22 NumberOfEventsInFlight = 5
23 NumberOfAlgosInFlight = 5
31 usage =
"%prog [options]"
32 parser = optparse.OptionParser(usage)
33 parser.add_option(
'-n', help=
'Number of events', dest=
'nevts', default=15)
34 parser.add_option(
'--eif', help=
'Events in flight', dest=
'eif', default=5)
35 parser.add_option(
'--aif', help=
'Algos in flight', dest=
'aif', default=10)
37 '--nthreads', help=
'Number of threads', dest=
'nthreads', default=10)
51 '-v', help=
'Verbosity level', dest=
'verbosity', default=5)
54 help=
'ExecuteWorkflow',
60 help=
'Launch in background',
65 '--scale', help=
'Scale Algorithms time', dest=
'scale', default=1)
66 options, args = parser.parse_args()
70 def replaceValues(cfg_name, n, eif, aif, nthreads, scale, clone, dumpQueues,
73 newcfglines = open(cfg_name,
"r").readlines()
74 cfg_name = cfg_name.replace(
".py",
"")
77 verb =
"_v%s" % verbosity
80 scale_s =
"_s%s" % scale
81 newcfgname =
"measurement_%s_n%s_eif%s_aif%s_nthreads%s_c%s_dq%s%s%s.py" % (
82 cfg_name, n, eif, aif, nthreads, clone, dumpQueues, scale_s, verb)
83 newcfg = open(newcfgname,
"w")
84 for line
in newcfglines:
85 if (
'NumberOfEvents' in line
and 'NUMBEROFEVENTS' in line
86 and not "FLIGHT" in line):
87 line = line.replace(
"NUMBEROFEVENTS", str(n))
88 if (
'NumberOfEventsInFlight' in line
89 and 'NUMBEROFEVENTSINFLIGHT' in line):
90 line = line.replace(
"NUMBEROFEVENTSINFLIGHT", str(eif))
91 if (
'NumberOfAlgosInFlight' in line
92 and 'NUMBEROFALGOSINFLIGHT' in line):
93 line = line.replace(
"NUMBEROFALGOSINFLIGHT", str(aif))
94 if (
'NumberOfThreads' in line
and 'NUMBEROFTHREADS' in line):
95 line = line.replace(
"NUMBEROFTHREADS", str(nthreads))
96 if (
'DumpQueues' in line
and 'DUMPQUEUES' in line):
97 line = line.replace(
"DUMPQUEUES", str(dumpQueues))
98 if (
'CloneAlgos' in line
and 'CLONEALGOS' in line):
99 line = line.replace(
"CLONEALGOS", str(clone))
100 if (
'Verbosity' in line
and 'VERBOSITY' in line):
101 line = line.replace(
"VERBOSITY", str(verbosity))
102 if (
'Scale' in line
and 'SCALE' in line):
103 line = line.replace(
"SCALE", str(scale))
109 if __name__ ==
"__main__":
112 options.eif, options.aif, options.nthreads,
113 float(options.scale), options.clone,
114 options.dumpqueues, options.verbosity)
116 logfile = newcfg.replace(
".py",
".log")
117 gaudirun =
"`alias gaudirun`"
118 gaudirun =
"/afs/cern.ch/user/d/dpiparo/Gaudi/build.x86_64-slc5-gcc46-opt/run gaudirun.py"
119 command =
"/usr/bin/time -f %%S -o timing_%s %s %s >& %s " % (
120 logfile, gaudirun, newcfg, logfile)
125 if options.execbrunel: