MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / run_benchmark

Function run_benchmark

tensorflow/python/eager/benchmarks_test.py:141–155  ·  view source on GitHub ↗
(func, num_iters, execution_mode=None)

Source from the content-addressed store, hash-verified

139
140
141def run_benchmark(func, num_iters, execution_mode=None):
142 ctx = context.context()
143 with context.execution_mode(execution_mode):
144 # call func to maybe warm up the GPU
145 func()
146 if execution_mode == context.ASYNC:
147 ctx.executor.wait()
148 start = time.time()
149 for _ in xrange(num_iters):
150 func()
151 if execution_mode == context.ASYNC:
152 ctx.executor.wait()
153 end = time.time()
154
155 return end - start
156
157
158class MicroBenchmarks(test.Benchmark):

Callers 2

_runMethod · 0.85
_runMethod · 0.85

Calls 5

execution_modeMethod · 0.80
timeMethod · 0.80
funcFunction · 0.50
contextMethod · 0.45
waitMethod · 0.45

Tested by

no test coverage detected