diff options
author | Fei Sun <feisun@fb.com> | 2018-07-26 14:38:27 -0700 |
---|---|---|
committer | Facebook Github Bot <facebook-github-bot@users.noreply.github.com> | 2018-07-26 14:39:17 -0700 |
commit | d1260d26fe4ef11c1831a4eab34508eff4ad95ff (patch) | |
tree | 21c355351805931b4e89d994a89ff555cfcbb946 /binaries | |
parent | 18a6541b82ff92ddeae29aeade87e465068696da (diff) | |
download | pytorch-d1260d26fe4ef11c1831a4eab34508eff4ad95ff.tar.gz pytorch-d1260d26fe4ef11c1831a4eab34508eff4ad95ff.tar.bz2 pytorch-d1260d26fe4ef11c1831a4eab34508eff4ad95ff.zip |
Sleep before run (#9891)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/9891
Add an argument to benchmark binary to specify the seconds to sleep before the run and after the warmup.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/9880
Reviewed By: llyfacebook
Differential Revision: D9014254
Pulled By: sf-wind
fbshipit-source-id: d5566186c8ed768f1e170e9266c5f2d6077391e0
Diffstat (limited to 'binaries')
-rw-r--r-- | binaries/benchmark_helper.cc | 6 | ||||
-rw-r--r-- | binaries/benchmark_helper.h | 1 | ||||
-rw-r--r-- | binaries/caffe2_benchmark.cc | 7 |
3 files changed, 12 insertions, 2 deletions
diff --git a/binaries/benchmark_helper.cc b/binaries/benchmark_helper.cc index 52b51174cf..27a593aaa8 100644 --- a/binaries/benchmark_helper.cc +++ b/binaries/benchmark_helper.cc @@ -215,7 +215,8 @@ void runNetwork( const bool wipe_cache, const bool run_individual, const int warmup, - const int iter) { + const int iter, + const int sleep_before_run) { if (!net_def.has_name()) { net_def.set_name("benchmark"); } @@ -234,6 +235,9 @@ void runNetwork( if (wipe_cache) { caffe2::wipe_cache(); } + if (sleep_before_run > 0) { + sleep(sleep_before_run); + } LOG(INFO) << "Main runs."; CAFFE_ENFORCE( iter >= 0, diff --git a/binaries/benchmark_helper.h b/binaries/benchmark_helper.h index 0a52e16a50..5af2d91cec 100644 --- a/binaries/benchmark_helper.h +++ b/binaries/benchmark_helper.h @@ -96,4 +96,5 @@ void runNetwork( const bool, const bool, const int, + const int, const int); diff --git a/binaries/caffe2_benchmark.cc b/binaries/caffe2_benchmark.cc index 729479a17c..2302106449 100644 --- a/binaries/caffe2_benchmark.cc +++ b/binaries/caffe2_benchmark.cc @@ -62,6 +62,10 @@ CAFFE2_DEFINE_bool( run_individual, false, "Whether to benchmark individual operators."); +CAFFE2_DEFINE_int( + sleep_before_run, + 0, + "The seconds to sleep before starting the benchmarking."); CAFFE2_DEFINE_bool( text_output, false, @@ -115,7 +119,8 @@ int main(int argc, char** argv) { caffe2::FLAGS_wipe_cache, caffe2::FLAGS_run_individual, caffe2::FLAGS_warmup, - caffe2::FLAGS_iter); + caffe2::FLAGS_iter, + caffe2::FLAGS_sleep_before_run); writeOutput( workspace, |