diff options
-rw-r--r-- | benchmark.py | 10 |
1 files 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))) |