onlyexec and onlyprint parameters added on openmp script

This commit is contained in:
Caner Candan 2010-11-27 23:22:54 +01:00
commit 6907b262e1

View file

@ -23,12 +23,15 @@ def parser(parser=optparse.OptionParser()):
parser.add_option('-o', '--output', help='give an output filename for logging', default=LOG_DEFAULT_FILENAME) parser.add_option('-o', '--output', help='give an output filename for logging', default=LOG_DEFAULT_FILENAME)
# general parameters ends # general parameters ends
parser.add_option('-r', '--nRun', default=100) parser.add_option('-r', '--nRun', default=100, help='how many times you would compute each iteration ?')
parser.add_option('-s', '--seed', default=1) parser.add_option('-s', '--seed', default=1, help='give here a seed value')
topic = str(datetime.today()) topic = str(datetime.today())
for char in [' ', ':', '-', '.']: topic = topic.replace(char, '_') for char in [' ', ':', '-', '.']: topic = topic.replace(char, '_')
parser.add_option('-t', '--topic', default='openmp_measures_' + topic + '/') parser.add_option('-t', '--topic', default='openmp_measures_' + topic + '/', help='give here a topic name used to create the folder')
parser.add_option('-E', '--onlyexecute', action='store_true', dest='onlyexecute', default=False, help='used this option if you only want to execute measures without generating images')
parser.add_option('-X', '--onlyprint', action='store_true', dest='onlyprint', default=False, help='used this option if you only want to generate images without executing measures, dont forget to set the good path in using --topic with a "/" at the end')
options, args = parser.parse_args() options, args = parser.parse_args()
@ -63,8 +66,10 @@ def do_measure( name, p, ps, P, d, ds, D, r=options.nRun, s=options.seed, v='log
pwd = options.topic + name + '_' pwd = options.topic + name + '_'
cmd = OPENMP_EXEC_FORMAT % (p, ps, P, d, ds, D, r, s, v, pwd) cmd = OPENMP_EXEC_FORMAT % (p, ps, P, d, ds, D, r, s, v, pwd)
logging.debug( cmd ) logging.debug( cmd )
if not options.onlyprint:
os.system( cmd ) os.system( cmd )
if not options.onlyexecute:
for cur in ['speedup', 'efficiency', 'dynamicity']: for cur in ['speedup', 'efficiency', 'dynamicity']:
filename = RESULT_FILE_FORMAT % (pwd, cur, p, ps, P, d, ds, D, r, s) filename = RESULT_FILE_FORMAT % (pwd, cur, p, ps, P, d, ds, D, r, s)
pylab.boxplot( get_boxplot_data( filename ) ) pylab.boxplot( get_boxplot_data( filename ) )
@ -77,6 +82,7 @@ def do_measure( name, p, ps, P, d, ds, D, r=options.nRun, s=options.seed, v='log
pylab.clf() pylab.clf()
def main(): def main():
if not options.onlyprint:
logging.info('creates first the new topic repository %s', options.topic) logging.info('creates first the new topic repository %s', options.topic)
os.mkdir( options.topic ) os.mkdir( options.topic )