From a21e6c3f33fe67a85a53b0f5fbfe802811e0ba43 Mon Sep 17 00:00:00 2001 From: Akihiro Nitta Date: Wed, 1 Jun 2022 06:23:21 +0900 Subject: [PATCH] Specify `Trainer(benchmark=False)` in parity benchmarks (#13182) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Carlos MocholĂ­ --- tests/benchmarks/test_basic_parity.py | 2 +- tests/benchmarks/test_sharded_parity.py | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/tests/benchmarks/test_basic_parity.py b/tests/benchmarks/test_basic_parity.py index 7a7962d337..d893262148 100644 --- a/tests/benchmarks/test_basic_parity.py +++ b/tests/benchmarks/test_basic_parity.py @@ -149,7 +149,6 @@ def vanilla_loop(cls_model, idx, device_type: str = "cuda", num_epochs=10): def lightning_loop(cls_model, idx, device_type: str = "cuda", num_epochs=10): seed_everything(idx) - torch.backends.cudnn.deterministic = True model = cls_model() # init model parts @@ -163,6 +162,7 @@ def lightning_loop(cls_model, idx, device_type: str = "cuda", num_epochs=10): devices=1, logger=False, replace_sampler_ddp=False, + benchmark=False, ) trainer.fit(model) diff --git a/tests/benchmarks/test_sharded_parity.py b/tests/benchmarks/test_sharded_parity.py index c80c1d2afc..78e90bd093 100644 --- a/tests/benchmarks/test_sharded_parity.py +++ b/tests/benchmarks/test_sharded_parity.py @@ -138,7 +138,13 @@ def plugin_parity_test( use_cuda = gpus > 0 trainer = Trainer( - fast_dev_run=True, max_epochs=1, accelerator="gpu", devices=gpus, precision=precision, strategy="ddp_spawn" + fast_dev_run=True, + max_epochs=1, + accelerator="gpu", + devices=gpus, + precision=precision, + strategy="ddp_spawn", + benchmark=False, ) max_memory_ddp, ddp_time = record_ddp_fit_model_stats(trainer=trainer, model=ddp_model, use_cuda=use_cuda) @@ -154,6 +160,7 @@ def plugin_parity_test( devices=gpus, precision=precision, strategy="ddp_sharded_spawn", + benchmark=False, ) assert isinstance(trainer.strategy, DDPSpawnShardedStrategy)