00077 :
00078
00079
00080 coresOption="4"
00081 cores=" --cores=4"
00082
00083 cpuOption=(1)
00084 cpu=" --cpu=1"
00085
00086 numevtsOption="100"
00087 numevts=" --timesize=100"
00088
00089 igprofevts=" --igprof=0"
00090 valgrindevts=" --valgrind=0"
00091
00092 candleOption=""
00093 candle=""
00094
00095 stepOption="GEN-SIM,DIGI,RECO"
00096 step=" --step="+stepOption
00097
00098 repeatOption=1
00099
00100 try:
00101 opts, args = getopt.getopt(argv, "n:hd", ["cpu=","cores=","numevts=","candle=","step=","repeat=","help"])
00102 except getopt.GetoptError:
00103 print "This argument option is not accepted"
00104 usage()
00105 sys.exit(2)
00106 for opt, arg in opts:
00107 if opt in ("-h", "--help"):
00108 usage()
00109 sys.exit()
00110 elif opt == '-d':
00111 global _debug
00112 _debug = 1
00113 elif opt == "--cpu":
00114 cpuOption=arg
00115 cpus=cpuOption.split(",")
00116 cpu=" --cpu="+cpuOption
00117 elif opt == "--cores":
00118 coresOption = arg
00119 elif opt in ("-n", "--numevts"):
00120 numevtsOption = arg
00121 numevts=" --timesize="+arg
00122 elif opt == "--candle":
00123 candleOption = arg
00124 candle=" --candle="+arg
00125 elif opt == "--step":
00126 stepOption = arg
00127 steps=stepOption.split(",")
00128 elif opt == "--repeat":
00129 repeatOption = int(arg)
00130
00131 if opts == []:
00132 print "No arguments given, so DEFAULT test will be run:"
00133
00134 import time
00135 date=time.ctime()
00136 path=os.path.abspath(".")
00137 print "CMS Benchmarking started running at %s on %s in directory %s, run by user %s" % (date,host,path,user)
00138
00139
00140
00141 print "This machine (%s) is assumed to have %s cores, and the suite will be run on cpu(s) %s" %(host,coresOption,cpuOption)
00142 print "%s events per test will be run" % numevtsOption
00143 if candleOption !="":
00144 print "Running only %s candle, instead of all the candles in the performance suite" % candleOption
00145 if stepOption != "":
00146 print "Profiling only the following steps: %s" % stepOption
00147 step=" --step="+stepOption
00148
00149
00150
00151
00152
00153
00154 if repeatOption !=1:
00155 print "The benchmarking will be repeated %s times" % repeatOption
00156
00157 for repetition in range(repeatOption):
00158 mkdircdcmd="mkdir Run"+str(repetition+1)+";cd Run"+str(repetition+1)
00159
00160
00161
00162
00163 PerfSuitecmd="cmsPerfSuite.py" + cpu + cores + numevts + igprofevts + valgrindevts + candle + step + ">& cmsPerfSuiteRun" + str(repetition + 1) + ".log"
00164 launchcmd=mkdircdcmd+";"+PerfSuitecmd
00165 print launchcmd
00166 sys.stdout.flush()
00167
00168
00169 launchcmdstdout=Popen(launchcmd,shell=True,stdout=subprocess.PIPE,stderr=subprocess.STDOUT).stdout.read()
00170 print launchcmdstdout