CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Functions | Variables
cmsBenchmark Namespace Reference

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"]
 

Function Documentation

def cmsBenchmark.main (   argv)

Definition at line 76 of file cmsBenchmark.py.

References usage().

76 
77 def main(argv):
78  #Some default values:
79  #Number of cpu cores on the machine
80  coresOption="4"
81  cores=" --cores=4"
82  #Cpu core(s) on which the suite is run:
83  cpuOption=(1) #not necessary to use tuple for single cpu, but for type consistency use ().
84  cpu=" --cpu=1"
85  #Number of events per test (per candle/per step):
86  numevtsOption="100"
87  numevts=" --timesize=100"
88  #default benchmark does not run igprof nor valgrind
89  igprofevts=" --igprof=0"
90  valgrindevts=" --valgrind=0"
91  #Default option for candle is "" since, usually all 7 candles of the suite will be run!
92  candleOption=""
93  candle=""
94  #Default option for step is ["GEN,SIM","DIGI","RECO"] since we don't need to profile all steps of the suite
95  stepOption="GEN-SIM,DIGI,RECO"
96  step=" --step="+stepOption
97  #Default option for repeat
98  repeatOption=1 #Use integer here since it will be used directly in the script
99  #Let's check the command line arguments
100  try:
101  opts, args = getopt.getopt(argv, "n:hd", ["cpu=","cores=","numevts=","candle=","step=","repeat=","help"])
102  except getopt.GetoptError:
103  print "This argument option is not accepted"
104  usage()
105  sys.exit(2)
106  for opt, arg in opts:
107  if opt in ("-h", "--help"):
108  usage()
109  sys.exit()
110  elif opt == '-d':
111  global _debug
112  _debug = 1
113  elif opt == "--cpu":
114  cpuOption=arg
115  cpus=cpuOption.split(",")
116  cpu=" --cpu="+cpuOption
117  elif opt == "--cores":
118  coresOption = arg
119  elif opt in ("-n", "--numevts"):
120  numevtsOption = arg
121  numevts=" --timesize="+arg
122  elif opt == "--candle":
123  candleOption = arg
124  candle=" --candle="+arg
125  elif opt == "--step":
126  stepOption = arg
127  steps=stepOption.split(",")
128  elif opt == "--repeat":
129  repeatOption = int(arg)
130  #Case with no arguments (using defaults)
131  if opts == []:
132  print "No arguments given, so DEFAULT test will be run:"
133  #Print a time stamp at the beginning:
134  import time
135  date=time.ctime()
136  path=os.path.abspath(".")
137  print "CMS Benchmarking started running at %s on %s in directory %s, run by user %s" % (date,host,path,user)
138  #showtags=os.popen4("showtags -r")[1].read()
139  #print showtags
140  #For the log:
141  print "This machine (%s) is assumed to have %s cores, and the suite will be run on cpu(s) %s" %(host,coresOption,cpuOption)
142  print "%s events per test will be run" % numevtsOption
143  if candleOption !="":
144  print "Running only %s candle, instead of all the candles in the performance suite" % candleOption
145  if stepOption != "":
146  print "Profiling only the following steps: %s" % stepOption
147  step=" --step="+stepOption
148  #This "unpacking" of the steps is better done in cmsPerfSuite.py or the cmsSimPyRelVal.py (.pl for now)
149  #steps=stepOption.split(",")
150  #cmsPerfSuiteSteps=[]
151  #for step in steps:
152  # newstep=reduce(lambda a,b:a+","+b,step.split("-"))
153  # cmsPerfSuiteSteps.append(newstep)
154  if repeatOption !=1:
155  print "The benchmarking will be repeated %s times" % repeatOption
156  #Now let's play!
157  for repetition in range(repeatOption):
158  mkdircdcmd="mkdir Run"+str(repetition+1)+";cd Run"+str(repetition+1)
159  #mkdircdstdout=os.popen4(mkdircmd)[1].read()
160  #if mkdirstdout:
161  # print mkdirstdout,
162  #print "Here we'd launch cmsPerfSuite.py!"
163  PerfSuitecmd="cmsPerfSuite.py" + cpu + cores + numevts + igprofevts + valgrindevts + candle + step + ">& cmsPerfSuiteRun" + str(repetition + 1) + ".log"
164  launchcmd=mkdircdcmd+";"+PerfSuitecmd
165  print launchcmd
166  sys.stdout.flush()
167  #Obsolete popen4-> subprocess.Popen
168  #launchcmdstdout=os.popen4(launchcmd)[1].read()
169  launchcmdstdout=Popen(launchcmd,shell=True,stdout=subprocess.PIPE,stderr=subprocess.STDOUT).stdout.read()
170  print launchcmdstdout
def cmsBenchmark.usage ( )

Definition at line 73 of file cmsBenchmark.py.

Referenced by main().

73 
74 def usage():
75  print __doc__

Variable Documentation

list cmsBenchmark.cmssw_base = os.environ["CMSSW_BASE"]

Definition at line 60 of file cmsBenchmark.py.

Referenced by fit::RootMinuitCommands< Function >.init(), metsig::SignAlgoResolutions.initializeJetResolutions(), and main().

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.