提交 cdb4ab21 authored 作者: AlOa's avatar AlOa

Chage op name in test scripts and add env flag

上级 74a105e8
...@@ -14,6 +14,7 @@ def runScript(): ...@@ -14,6 +14,7 @@ def runScript():
return map(float, out.split(" ")) return map(float, out.split(" "))
if __name__ == '__main__': if __name__ == '__main__':
os.environ['THEANO_FLAGS'] = 'openmp=false'
(cheapTime, costlyTime) = runScript() (cheapTime, costlyTime) = runScript()
os.environ['THEANO_FLAGS'] = 'openmp=true' os.environ['THEANO_FLAGS'] = 'openmp=true'
(cheapTimeOpenmp, costlyTimeOpenmp) = runScript() (cheapTimeOpenmp, costlyTimeOpenmp) = runScript()
...@@ -32,6 +33,6 @@ if __name__ == '__main__': ...@@ -32,6 +33,6 @@ if __name__ == '__main__':
costlySpeed = (costlyTimeOpenmp - costlyTime) / costlyTimeOpenmp costlySpeed = (costlyTimeOpenmp - costlyTime) / costlyTimeOpenmp
costlySpeedstring = "slowdown" costlySpeedstring = "slowdown"
print "Cheap op time without openmp %fs with openmp %fs %s %2.2f%%" % (cheapTime, cheapTimeOpenmp, cheapSpeedstring, cheapSpeed*100) print "Fast op time without openmp %fs with openmp %fs %s %2.2f%%" % (cheapTime, cheapTimeOpenmp, cheapSpeedstring, cheapSpeed*100)
print "Costly op time without openmp %fs with openmp %fs %s %2.2f%%" % (costlyTime, costlyTimeOpenmp, costlySpeedstring, costlySpeed*100) print "Slow op time without openmp %fs with openmp %fs %s %2.2f%%" % (costlyTime, costlyTimeOpenmp, costlySpeedstring, costlySpeed*100)
...@@ -7,7 +7,7 @@ from optparse import OptionParser ...@@ -7,7 +7,7 @@ from optparse import OptionParser
import sys import sys
parser = OptionParser(usage='%prog <options>\n Compute time for' parser = OptionParser(usage='%prog <options>\n Compute time for'
'cheap and costly elemwise operations') ' fast and slow elemwise operations')
parser.add_option('-N', '--N', action='store', dest='N', parser.add_option('-N', '--N', action='store', dest='N',
default=theano.config.openmp_elemwise_minsize, type="int", default=theano.config.openmp_elemwise_minsize, type="int",
help="Number of vector element") help="Number of vector element")
...@@ -37,10 +37,10 @@ def ElemwiseOpTime(N, script=False, loops=1000): ...@@ -37,10 +37,10 @@ def ElemwiseOpTime(N, script=False, loops=1000):
if not script: if not script:
if theano.config.openmp: if theano.config.openmp:
print "With openmp:" print "With openmp:"
print "Cheap op ", print "Fast op ",
ceapTime = evalTime(f, v, script=script, loops=loops) ceapTime = evalTime(f, v, script=script, loops=loops)
if not script: if not script:
print "Costly op ", print "Slow op ",
costlyTime = evalTime(f1, v, script=script, loops=loops) costlyTime = evalTime(f1, v, script=script, loops=loops)
return (ceapTime, costlyTime) return (ceapTime, costlyTime)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论