Functions | |
def | main |
def | usage |
Variables | |
list | cmssw_base = os.environ["CMSSW_BASE"] |
list | cmssw_release_base = os.environ["CMSSW_RELEASE_BASE"] |
list | cmssw_version = os.environ["CMSSW_VERSION"] |
list | host = os.environ["HOST"] |
string | Script = "cmsPerfSuite.py" |
list | user = os.environ["USER"] |
def cmsBenchmark::main | ( | argv | ) |
Definition at line 76 of file cmsBenchmark.py.
00077 : 00078 #Some default values: 00079 #Number of cpu cores on the machine 00080 coresOption="4" 00081 cores=" --cores=4" 00082 #Cpu core(s) on which the suite is run: 00083 cpuOption=(1) #not necessary to use tuple for single cpu, but for type consistency use (). 00084 cpu=" --cpu=1" 00085 #Number of events per test (per candle/per step): 00086 numevtsOption="100" 00087 numevts=" --timesize=100" 00088 #default benchmark does not run igprof nor valgrind 00089 igprofevts=" --igprof=0" 00090 valgrindevts=" --valgrind=0" 00091 #Default option for candle is "" since, usually all 7 candles of the suite will be run! 00092 candleOption="" 00093 candle="" 00094 #Default option for step is ["GEN,SIM","DIGI","RECO"] since we don't need to profile all steps of the suite 00095 stepOption="GEN-SIM,DIGI,RECO" 00096 step=" --step="+stepOption 00097 #Default option for repeat 00098 repeatOption=1 #Use integer here since it will be used directly in the script 00099 #Let's check the command line arguments 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 #Case with no arguments (using defaults) 00131 if opts == []: 00132 print "No arguments given, so DEFAULT test will be run:" 00133 #Print a time stamp at the beginning: 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 #showtags=os.popen4("showtags -r")[1].read() 00139 #print showtags 00140 #For the log: 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 #This "unpacking" of the steps is better done in cmsPerfSuite.py or the cmsSimPyRelVal.py (.pl for now) 00149 #steps=stepOption.split(",") 00150 #cmsPerfSuiteSteps=[] 00151 #for step in steps: 00152 # newstep=reduce(lambda a,b:a+","+b,step.split("-")) 00153 # cmsPerfSuiteSteps.append(newstep) 00154 if repeatOption !=1: 00155 print "The benchmarking will be repeated %s times" % repeatOption 00156 #Now let's play! 00157 for repetition in range(repeatOption): 00158 mkdircdcmd="mkdir Run"+str(repetition+1)+";cd Run"+str(repetition+1) 00159 #mkdircdstdout=os.popen4(mkdircmd)[1].read() 00160 #if mkdirstdout: 00161 # print mkdirstdout, 00162 #print "Here we'd launch cmsPerfSuite.py!" 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 #Obsolete popen4-> subprocess.Popen 00168 #launchcmdstdout=os.popen4(launchcmd)[1].read() 00169 launchcmdstdout=Popen(launchcmd,shell=True,stdout=subprocess.PIPE,stderr=subprocess.STDOUT).stdout.read() 00170 print launchcmdstdout
def cmsBenchmark::usage | ( | ) |
Definition at line 73 of file cmsBenchmark.py.
list cmsBenchmark::cmssw_base = os.environ["CMSSW_BASE"] |
Definition at line 60 of file cmsBenchmark.py.
list cmsBenchmark::cmssw_release_base = os.environ["CMSSW_RELEASE_BASE"] |
Definition at line 61 of file cmsBenchmark.py.
Referenced by fit::RootMinuitCommands< Function >::init(), metsig::SignAlgoResolutions::initializeJetResolutions(), and main().
list cmsBenchmark::cmssw_version = os.environ["CMSSW_VERSION"] |
Definition at line 62 of file cmsBenchmark.py.
list cmsBenchmark::host = os.environ["HOST"] |
Definition at line 63 of file cmsBenchmark.py.
string cmsBenchmark::Script = "cmsPerfSuite.py" |
Definition at line 67 of file cmsBenchmark.py.
list cmsBenchmark::user = os.environ["USER"] |
Definition at line 64 of file cmsBenchmark.py.