From a3564a8cd0e1a9b2f5492f4094363e7c8b40f21e Mon Sep 17 00:00:00 2001 From: Anthony LaTorre Date: Fri, 19 Aug 2011 22:12:21 -0400 Subject: ignore first kernel call in benchmarks --- benchmark.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/benchmark.py b/benchmark.py index 0f72811..441b85f 100644 --- a/benchmark.py +++ b/benchmark.py @@ -55,7 +55,10 @@ def ray_trace(gpu, number=1000): gpu.kernels.ray_trace(np.int32(pixels_gpu.size), origins_gpu, directions_gpu, pixels_gpu, block=(gpu.nthreads_per_block,1,1), grid=(pixels_gpu.size//gpu.nthreads_per_block+1,1)) gpu.context.synchronize() elapsed = time.time() - t0 - run_times.append(elapsed) + + if i > 0: + # first kernel call incurs some driver overhead + run_times.append(elapsed) return pixels_gpu.size/ufloat((np.mean(run_times),np.std(run_times))) @@ -82,7 +85,10 @@ def propagate(gpu, number=10, nphotons=500000): gpu.propagate() gpu.context.synchronize() elapsed = time.time() - t0 - run_times.append(elapsed) + + if i > 0: + # first kernel call incurs some driver overhead + run_times.append(elapsed) return nphotons/ufloat((np.mean(run_times),np.std(run_times))) -- cgit