The Gaudi Framework  master (b9786168)
Loading...
Searching...
No Matches
brunelWrapper Namespace Reference

Functions

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

Variables

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

Function Documentation

◆ createParser()

brunelWrapper.createParser ( )

Definition at line 30 of file brunelWrapper.py.

30def createParser():
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)
36 parser.add_option(
37 "--nthreads", help="Number of threads", dest="nthreads", default=10
38 )
39 parser.add_option(
40 "--clone", help="Clone Algos", dest="clone", action="store_true", default=False
41 )
42 parser.add_option(
43 "--dumpQueues",
44 help="Dump Queues",
45 dest="dumpqueues",
46 action="store_true",
47 default=False,
48 )
49 parser.add_option("-v", help="Verbosity level", dest="verbosity", default=5)
50 parser.add_option(
51 "--exec",
52 help="ExecuteWorkflow",
53 dest="execbrunel",
54 action="store_true",
55 default=False,
56 )
57 parser.add_option(
58 "--bg",
59 help="Launch in background",
60 dest="bg",
61 action="store_true",
62 default=False,
63 )
64 parser.add_option("--scale", help="Scale Algorithms time", dest="scale", default=1)
65 options, args = parser.parse_args()
66 return options
67
68

◆ replaceValues()

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

Definition at line 69 of file brunelWrapper.py.

69def replaceValues(cfg_name, n, eif, aif, nthreads, scale, clone, dumpQueues, verbosity):
70 newcfglines = open(cfg_name, "r").readlines()
71 cfg_name = cfg_name.replace(".py", "")
72 verb = ""
73 if verbosity != 6:
74 verb = "_v%s" % verbosity
75 scale_s = ""
76 if scale != 1:
77 scale_s = "_s%s" % scale
78 newcfgname = "measurement_%s_n%s_eif%s_aif%s_nthreads%s_c%s_dq%s%s%s.py" % (
79 cfg_name,
80 n,
81 eif,
82 aif,
83 nthreads,
84 clone,
85 dumpQueues,
86 scale_s,
87 verb,
88 )
89 newcfg = open(newcfgname, "w")
90 for line in newcfglines:
91 if (
92 "NumberOfEvents" in line
93 and "NUMBEROFEVENTS" in line
94 and "FLIGHT" not in line
95 ):
96 line = line.replace("NUMBEROFEVENTS", str(n))
97 if "NumberOfEventsInFlight" in line and "NUMBEROFEVENTSINFLIGHT" in line:
98 line = line.replace("NUMBEROFEVENTSINFLIGHT", str(eif))
99 if "NumberOfAlgosInFlight" in line and "NUMBEROFALGOSINFLIGHT" in line:
100 line = line.replace("NUMBEROFALGOSINFLIGHT", str(aif))
101 if "NumberOfThreads" in line and "NUMBEROFTHREADS" in line:
102 line = line.replace("NUMBEROFTHREADS", str(nthreads))
103 if "DumpQueues" in line and "DUMPQUEUES" in line:
104 line = line.replace("DUMPQUEUES", str(dumpQueues))
105 if "CloneAlgos" in line and "CLONEALGOS" in line:
106 line = line.replace("CLONEALGOS", str(clone))
107 if "Verbosity" in line and "VERBOSITY" in line:
108 line = line.replace("VERBOSITY", str(verbosity))
109 if "Scale" in line and "SCALE" in line:
110 line = line.replace("SCALE", str(scale))
111 newcfg.write(line)
112 newcfg.close()
113 return newcfgname
114
115

Variable Documentation

◆ command

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

Definition at line 135 of file brunelWrapper.py.

◆ gaudirun

tuple brunelWrapper.gaudirun = "`alias gaudirun`"

Definition at line 131 of file brunelWrapper.py.

◆ logfile

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

Definition at line 130 of file brunelWrapper.py.

◆ newcfg

brunelWrapper.newcfg
Initial value:
1= replaceValues(
2 "BrunelScenario.py",
3 options.nevts,
4 options.eif,
5 options.aif,
6 options.nthreads,
7 float(options.scale),
8 options.clone,
9 options.dumpqueues,
10 options.verbosity,
11 )

Definition at line 118 of file brunelWrapper.py.

◆ options

brunelWrapper.options = createParser()

Definition at line 117 of file brunelWrapper.py.