calculate execution time based on final iterations (#19299)
authorMingzhe Li <mingzhe0908@fb.com>
Tue, 16 Apr 2019 15:47:25 +0000 (08:47 -0700)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Tue, 16 Apr 2019 15:57:17 +0000 (08:57 -0700)
commit35015762307a68654b8c72d690b7e3e58c3ad137
treea4ea16c7521c1d0a5aa10c0173dea3fc8281b019
parent646cb6157df948643ec98b8947026ccaee5c7415
calculate execution time based on final iterations (#19299)

Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/19299

I saw larger than 5% performance variation with small operators, this diff aims to reduce the variation by avoiding python overhead. Previously, in the benchmark, we run the main loop for 100 iterations then look at the time. If it's not significant, we will double the number of iterations to rerun and look at the result. We continue this process until it becomes significant. We calculate the time by total_time / number of iterations. The issue is that we are including multiple python trigger overhead.

Now, I change the logic to calculate execution time based on the last run instead of all runs, the equation is time_in_last_run/number of iterations.

Reviewed By: hl475

Differential Revision: D14925287

fbshipit-source-id: cb646298c08a651e27b99a5547350da367ffff47
benchmarks/operator_benchmark/benchmark_core.py