Skip to content

Commit 1683c47

Browse files
committed
warm up.
1 parent a09768f commit 1683c47

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

benchmarks/benchmarking_utils.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
logging.basicConfig(level=logging.INFO, format="%(asctime)s %(levelname)s %(name)s: %(message)s")
2020
logger = logging.getLogger(__name__)
2121

22+
NUM_WARMUP_ROUNDS = 5
23+
2224

2325
def benchmark_fn(f, *args, **kwargs):
2426
t0 = benchmark.Timer(
@@ -230,6 +232,8 @@ def _run_phase(
230232
# measure
231233
run_ctx = torch._inductor.utils.fresh_inductor_cache() if compile_kwargs else nullcontext()
232234
with run_ctx:
235+
for _ in range(NUM_WARMUP_ROUNDS):
236+
_ = model(**inp)
233237
time_s = benchmark_fn(lambda m, d: m(**d), model, inp)
234238
mem_gb = torch.cuda.max_memory_allocated() / (1024**3)
235239
mem_gb = round(mem_gb, 2)

0 commit comments

Comments
 (0)