Skip to content

Commit

Permalink
Increase mimimum number of warmup runs to 2 (#58801)
Browse files Browse the repository at this point in the history
Summary:
The JIT will typically need two warmup runs to do profiling and optimization.
This is not the perfect solution but it will substantially reduce the number of surprised people when the docs say torch.utils.benchmark.Timer takes care of warmup.

Pull Request resolved: #58801

Reviewed By: desertfire

Differential Revision: D28644244

Pulled By: robieta

fbshipit-source-id: cc54ed019e882a379d6e4a0c6a01fd5873dd41c3
  • Loading branch information
t-vi authored and facebook-github-bot committed May 25, 2021
1 parent 09a1b1c commit 2ef9a1d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion torch/utils/benchmark/utils/timer.py
Expand Up @@ -259,7 +259,7 @@ def timeit(self, number: int = 1000000) -> common.Measurement:
"""
with common.set_torch_threads(self._task_spec.num_threads):
# Warmup
self._timer.timeit(number=max(int(number // 100), 1))
self._timer.timeit(number=max(int(number // 100), 2))

return common.Measurement(
number_per_run=number,
Expand Down

0 comments on commit 2ef9a1d

Please sign in to comment.