2 import cmsPerfPublish
as cspp
3 import cmsPerfSuite
as cps
4 import cmsPerfHarvest
as cph
8 from cmsPerfCommons
import Candles
10 import socket, os, sys, SimpleXMLRPCServer, threading, exceptions
13 for candle
in Candles:
14 CandlesString=CandlesString+
","+candle
15 print CandlesString[1:]
16 _outputdir = os.getcwd()
19 _PROG_NAME = os.path.basename(sys.argv[0])
20 _CASTOR_DIR =
"/castor/cern.ch/cms/store/relval/performance/"
21 _DEFAULTS = {
"castordir" : _CASTOR_DIR,
22 "perfsuitedir" : os.getcwd(),
23 "TimeSizeEvents" : 100 ,
24 "TimeSizeCandles" :
"",
25 "TimeSizePUCandles" :
"",
27 "IgProfCandles" :
"" ,
28 "IgProfPUCandles" :
"" ,
29 "CallgrindEvents" : 0 ,
30 "CallgrindCandles" :
"" ,
31 "CallgrindPUCandles" :
"" ,
32 "MemcheckEvents" : 0 ,
33 "MemcheckCandles" :
"" ,
34 "MemcheckPUCandles" :
"" ,
36 "cmsScimarkLarge" : 10 ,
44 "isAllCandles" :
True ,
48 "logfile" : os.path.join(os.getcwd(),
"cmsPerfSuite.log")}
52 parser = opt.OptionParser(usage=(
"""%s [Options]""" % _PROG_NAME))
54 parser.add_option(
'-p',
59 help=
'Run server on a particular port',
63 parser.add_option(
'-o',
68 help=
'The output directory for all the cmsPerfSuite runs',
72 (options, args) = parser.parse_args()
74 if not options.outputdir ==
"":
75 options.outputdir = os.path.abspath(options.outputdir)
76 if not os.path.exists(options.outputdir):
77 parser.error(
"the specified output directory %s does not exist" % options.outputdir)
80 _DEFAULTS[
"perfsuitedir"] = options.outputdir
83 _outputdir = options.outputdir
85 return (options.port,options.outputdir)
99 server = SimpleXMLRPCServer.SimpleXMLRPCServer((socket.gethostname(),port))
100 server.register_function(request_benchmark)
101 except socket.error, detail:
102 print "ERROR: Could not initialise server:", detail
106 print "Running server on port %s... " % port
110 server.handle_request()
112 except (KeyboardInterrupt, SystemExit):
114 server.server_close()
118 server.server_close()
120 server.server_close()
142 for line
in open(logfile,
"r"):
144 except (OSError, IOError) , detail:
149 if dict.has_key(key):
152 return _DEFAULTS[key]
160 global _outputdir, _reqnumber
161 print "Commands received running perfsuite for these jobs:"
174 topdir = os.path.join(_outputdir,
"request_" + str(_reqnumber))
175 exists = os.path.exists(topdir)
180 curperfdir = os.path.abspath(os.path.join(topdir,str(cmd_num)))
181 if not os.path.exists(curperfdir):
183 logfile = os.path.join(curperfdir,
"cmsPerfSuite.log")
184 if os.path.exists(logfile):
185 logfile = logfile + str(cmd_num)
187 if cmd.has_key(
'cpus'):
188 if cmd[
'cpus'] ==
"All":
189 print "Running performance suite on all CPUS!\n"
192 cmd[
"cpus"]=cmd[
"cpus"]+str(cpu)+
","
193 cmd[
"cpus"]=cmd[
"cpus"][:-1]
194 print "I.e. on cpus %s\n"%cmd[
"cpus"]
199 cmdwdefs[
"perfsuitedir" ] = curperfdir
200 cmdwdefs[
"TimeSizeEvents" ] =
getCPSkeyword(
"TimeSizeEvents" , cmd)
201 cmdwdefs[
"TimeSizeCandles" ] =
getCPSkeyword(
"TimeSizeCandles" , cmd)
202 cmdwdefs[
"TimeSizePUCandles" ] =
getCPSkeyword(
"TimeSizePUCandles" , cmd)
203 cmdwdefs[
"IgProfEvents" ] =
getCPSkeyword(
"IgProfEvents" , cmd)
204 cmdwdefs[
"IgProfCandles" ] =
getCPSkeyword(
"IgProfCandles" , cmd)
205 cmdwdefs[
"IgProfPUCandles" ] =
getCPSkeyword(
"IgProfPUCandles" , cmd)
206 cmdwdefs[
"CallgrindEvents" ] =
getCPSkeyword(
"CallgrindEvents" , cmd)
207 cmdwdefs[
"CallgrindCandles"] =
getCPSkeyword(
"CallgrindCandles" , cmd)
208 cmdwdefs[
"CallgrindPUCandles"] =
getCPSkeyword(
"CallgrindPUCandles" , cmd)
209 cmdwdefs[
"MemcheckEvents" ] =
getCPSkeyword(
"MemcheckEvents" , cmd)
210 cmdwdefs[
"MemcheckCandles" ] =
getCPSkeyword(
"MemcheckCandles" , cmd)
211 cmdwdefs[
"MemcheckPUCandles" ] =
getCPSkeyword(
"MemcheckPUCandles" , cmd)
213 cmdwdefs[
"cmsScimarkLarge" ] =
getCPSkeyword(
"cmsScimarkLarge" , cmd)
214 cmdwdefs[
"cmsdriverOptions"] =
getCPSkeyword(
"cmsdriverOptions", cmd)
215 cmdwdefs[
"stepOptions" ] =
getCPSkeyword(
"stepOptions" , cmd)
225 cmdwdefs[
"logfile" ] = logfile
226 logh = open(logfile,
"w")
227 logh.write(
"This perfsuite run was configured with the following options:\n")
229 for key
in cmdwdefs.keys():
230 logh.write(key +
"\t" +str(cmdwdefs[key])+
"\n")
232 print "Calling cmsPerfSuite.main() function\n"
235 "-t",cmdwdefs[
"TimeSizeEvents" ],
236 "--RunTimeSize",cmdwdefs[
"TimeSizeCandles"],
237 "-o",cmdwdefs[
"perfsuitedir" ],
244 "--cmsScimark",cmdwdefs[
"cmsScimark" ],
245 "--cmsScimarkLarge",cmdwdefs[
"cmsScimarkLarge" ],
246 "--cmsdriver",cmdwdefs[
"cmsdriverOptions"],
247 "--step",cmdwdefs[
"stepOptions" ],
250 "--cpu",cmdwdefs[
"cpus" ],
251 "--cores",cmdwdefs[
"cores" ],
259 cps.main(cpsInputArgs)
260 print "Running of the Performance Suite is done!"
266 outs.append((cmdwdefs,cph.harvest(curperfdir)))
272 except exceptions.Exception, detail:
274 logh = open(os.path.join(os.getcwd(),
"error.log"),
"a")
275 logh.write(str(detail) +
"\n")
285 server_thread = threading.Thread(target =
runserv(port))
286 server_thread.setDaemon(
True)
287 server_thread.start()
289 if __name__ ==
"__main__":