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. 7 from __future__
import print_function
12 NumberOfEventsInFlight = 5 13 NumberOfAlgosInFlight = 5 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)
27 '--nthreads', help=
'Number of threads', dest=
'nthreads', default=10)
41 '-v', help=
'Verbosity level', dest=
'verbosity', default=5)
44 help=
'ExecuteWorkflow',
50 help=
'Launch in background',
55 '--scale', help=
'Scale Algorithms time', dest=
'scale', default=1)
56 options, args = parser.parse_args()
60 def replaceValues(cfg_name, n, eif, aif, nthreads, scale, clone, dumpQueues,
63 newcfglines = open(cfg_name,
"r").readlines()
64 cfg_name = cfg_name.replace(
".py",
"")
67 verb =
"_v%s" % verbosity
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))
99 if __name__ ==
"__main__":
102 options.eif, options.aif, options.nthreads,
103 float(options.scale), options.clone,
104 options.dumpqueues, options.verbosity)
106 logfile = newcfg.replace(
".py",
".log")
107 gaudirun =
"`alias gaudirun`" 108 gaudirun =
"/afs/cern.ch/user/d/dpiparo/Gaudi/build.x86_64-slc5-gcc46-opt/run gaudirun.py" 109 command =
"/usr/bin/time -f %%S -o timing_%s %s %s >& %s " % (
110 logfile, gaudirun, newcfg, logfile)
115 if options.execbrunel:
def replaceValues(cfg_name, n, eif, aif, nthreads, scale, clone, dumpQueues, verbosity)