我正在努力使用python编写的模拟器。这个模拟器有两个选项来完成这个任务,它们是-p(一次一个任务)和-benchmark(多个任务)。--基准测试无法工作,因为命令行未正确发送到模拟器问题是什么造成了差异以及如何解决这个问题
与以下内容相关的代码部分:
1)这是模拟器的用法,我理解:
def usage():
print 'Run benchmark under the Sniper simulator'
print 'Usage:'
print ' %s -p <program> -i <inputsize (test)> -n <ncores (1)> -m <machines (1)> -d <outputdir (.)> -c <config-file> -r <sniper-root-dir> -g <options>' % sys.argv[0]
print 'Benchmarks:'
for module in sorted(modules):
module = __import__(module)
print ' ', module.__name__ + ':'
try:
print ' ', ' '.join(module.allbenchmarks())
#print("sys.argv="+str(sys.argv))
except TypeError:
print 'INFO: %s not downloaded yet, run make to download its components.' % module.__name__
sys.exit(2)
(二)
opts_passthrough = [ 'profile', 'perf', 'gdb', 'gdb-wait', 'gdb-quit', 'appdebug', 'appdebug-manual', 'appdebug-enable', 'power', 'cache-only', 'fast-forward', 'no-cache-warming', 'save-patch', 'pin-stats', 'viz', 'viz-aso', 'wrap-sim=', 'sift' ]
try:
opts, args = getopt.getopt(sys.argv[1:], "hvp:i:B:n:m:s:d:c:r:g:", [ "no-roi", "roi-script", "roi", "sim-end=", "save-run", "save-run-prefix=", "save-run-second-stage=", "benchmarks=" ] + opts_passthrough)
print("args-try-run-sniper="+str(args))
print("opts-try-run-sniper"+str(opts))
except getopt.GetoptError, e:
some codes ...
if o == '--benchmarks':
for bm in a.split(','):
print("bm="+str(bm))
benchmarks.append(bm.split('-'))
print("benchmarks.append="+str(bm.split('-')))
if not ncores:
ncores = sum([ int(app_nthreads) for package, programname, inputsize, app_nthreads in benchmarks ])
(三)
try:
opts, cmdline = getopt.getopt(sys.argv[1:], "hvo:d:f:b:e:s:r:X:", [ "roi", "roi-mpi", "gdb", "gdb-wait", "gdb-quit", "gdb-screen", "follow", "pa", "routine-tracing", "pinball=", "outputdir=", "pinplay-addr-trans", "pid=", "stop-address=", "pid-continue", "frontend=", "frontend-option=", "isa=", "ncores=", "maxthreads=" ])
print("cmdline-try="+str(cmdline))
print("opts-try="+str(opts))
except getopt.GetoptError, e:
some codes ...
(四)
if 'pin' in frontend:
print '[RECORD-TRACE] Using Pin frontend (frontend/pin-frontend)'
cmd = '%(pin_home)s/pin %(pinoptions)s -t %(HOME)s/frontend/pin-frontend/obj-%(arch)s/pin_frontend -verbose %(value_verbose)d -debug %(gdb_screen)d -roi %(value_roi)d -roi-mpi %(value_roi_mpi)d -f %(fastforward)d -d %(detailed)d -b %(blocksize)d -o %(outputfile)s -e %(syscallemulation)d -s %(siftcountoffset)d -r %(useresponsefiles)d -pa %(value_pa)d -rtntrace %(value_routine_tracing)d -stop %(stop_address)d %(pinballoptions)s %(extra_args)s %(extrae)s -- ' % locals() + ' '.join(cmdline)
print("cmd-frontend/pin-frontend = " + str(cmd))
对于-p选项,(4)生成的cmd如下所示:
/home/ahmad/sniper/pin_kit/pin -mt -injection child -xyzzy -ifeellucky -follow_execv -t /home/ahmad/sniper/sift/recorder/obj-intel64/sift_recorder -verbose 0 -debug 0 -roi 1 -roi-mpi 0 -f 0 -d 0 -b 0 -o /tmp/tmptvuH3l/run_benchmarks -e 1 -s 0 -r 1 -pa 1 -rtntrace 1 -stop 0 -- /home/ahmad/sniper/benchmarks/splash2/splash2/codes/kernels/fft/FFT -m18 -p64
但是对于--benchmarks选项,(4)生成的cmd如下所示,这是不完整的,因为(3)没有生成cmdline,它是cmdline-try=[]
:
/home/ahmad/sniper/pin_kit/pin -mt -injection child -xyzzy -ifeellucky -follow_execv -t /home/ahmad/sniper/sift/recorder/obj-intel64/sift_recorder -verbose 0 -debug 0 -roi 1 -roi-mpi 0 -f 0 -d 0 -b 0 -o /tmp/tmptvuH3l/run_benchmarks -e 1 -s 0 -r 1 -pa 1 -rtntrace 1 -stop 0 --
仅供参考:大多数打印行是我自己添加的,用于获取信息
这里的代码文件也是为了进行更多的调查
目前没有回答
相关问题 更多 >
编程相关推荐