From a3d4e7c86a9cfbdd5ac659c5f584927271cb57f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20W=C3=A4lchli?= Date: Sun, 14 Feb 2021 01:42:18 +0100 Subject: [PATCH] move accelerator legacy tests (#5948) Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> --- benchmarks/test_sharded_parity.py | 2 +- dockers/tpu-tests/tpu_test_cases.jsonnet | 2 +- tests/accelerators/__init__.py | 12 ++++++++++++ tests/accelerators/{legacy => }/ddp_model.py | 0 tests/accelerators/legacy/__init__.py | 14 -------------- .../{legacy => }/test_accelerator_connector.py | 0 tests/accelerators/{legacy => }/test_ddp.py | 2 +- tests/accelerators/{legacy => }/test_ddp_spawn.py | 0 tests/accelerators/{legacy => }/test_dp.py | 0 .../{legacy => }/test_multi_nodes_gpu.py | 0 .../accelerators/{legacy => }/test_tpu_backend.py | 0 tests/trainer/properties/test_get_model.py | 2 +- 12 files changed, 16 insertions(+), 18 deletions(-) rename tests/accelerators/{legacy => }/ddp_model.py (100%) delete mode 100644 tests/accelerators/legacy/__init__.py rename tests/accelerators/{legacy => }/test_accelerator_connector.py (100%) rename tests/accelerators/{legacy => }/test_ddp.py (97%) rename tests/accelerators/{legacy => }/test_ddp_spawn.py (100%) rename tests/accelerators/{legacy => }/test_dp.py (100%) rename tests/accelerators/{legacy => }/test_multi_nodes_gpu.py (100%) rename tests/accelerators/{legacy => }/test_tpu_backend.py (100%) diff --git a/benchmarks/test_sharded_parity.py b/benchmarks/test_sharded_parity.py index f0476ffb7e155..a5fd6c2eff0df 100644 --- a/benchmarks/test_sharded_parity.py +++ b/benchmarks/test_sharded_parity.py @@ -23,7 +23,7 @@ from pytorch_lightning import seed_everything, Trainer from pytorch_lightning.plugins import DDPSpawnShardedPlugin from pytorch_lightning.utilities import _FAIRSCALE_AVAILABLE, _NATIVE_AMP_AVAILABLE -from tests.accelerators.legacy import DDPLauncher +from tests.accelerators import DDPLauncher from tests.helpers.boring_model import BoringModel, RandomDataset diff --git a/dockers/tpu-tests/tpu_test_cases.jsonnet b/dockers/tpu-tests/tpu_test_cases.jsonnet index 03cd3b7b65517..8c3f3693fda50 100644 --- a/dockers/tpu-tests/tpu_test_cases.jsonnet +++ b/dockers/tpu-tests/tpu_test_cases.jsonnet @@ -23,7 +23,7 @@ local tputests = base.BaseTest { cd pytorch-lightning coverage run --source=pytorch_lightning -m pytest -v --capture=no \ pytorch_lightning/utilities/xla_device_utils.py \ - tests/accelerators/legacy/test_tpu_backend.py \ + tests/accelerators/test_tpu_backend.py \ tests/models/test_tpu.py test_exit_code=$? echo "\n||| END PYTEST LOGS |||\n" diff --git a/tests/accelerators/__init__.py b/tests/accelerators/__init__.py index e69de29bb2d1d..9583ec9537437 100644 --- a/tests/accelerators/__init__.py +++ b/tests/accelerators/__init__.py @@ -0,0 +1,12 @@ +try: + from dtrun.launcher import DDPLauncher +except ImportError: + + class DDPLauncher: + + def run(cmd_line, **kwargs): + + def inner(func): + pass + + return inner diff --git a/tests/accelerators/legacy/ddp_model.py b/tests/accelerators/ddp_model.py similarity index 100% rename from tests/accelerators/legacy/ddp_model.py rename to tests/accelerators/ddp_model.py diff --git a/tests/accelerators/legacy/__init__.py b/tests/accelerators/legacy/__init__.py deleted file mode 100644 index 273f70080d7ec..0000000000000 --- a/tests/accelerators/legacy/__init__.py +++ /dev/null @@ -1,14 +0,0 @@ -# todo: feel free to move any of these "legacy" tests up... - -try: - from dtrun.launcher import DDPLauncher -except ImportError: - - class DDPLauncher: - - def run(cmd_line, **kwargs): - - def inner(func): - pass - - return inner diff --git a/tests/accelerators/legacy/test_accelerator_connector.py b/tests/accelerators/test_accelerator_connector.py similarity index 100% rename from tests/accelerators/legacy/test_accelerator_connector.py rename to tests/accelerators/test_accelerator_connector.py diff --git a/tests/accelerators/legacy/test_ddp.py b/tests/accelerators/test_ddp.py similarity index 97% rename from tests/accelerators/legacy/test_ddp.py rename to tests/accelerators/test_ddp.py index 48cef6d595946..1bd9e36d4f205 100644 --- a/tests/accelerators/legacy/test_ddp.py +++ b/tests/accelerators/test_ddp.py @@ -16,7 +16,7 @@ import pytest import torch -from tests.accelerators.legacy import ddp_model, DDPLauncher +from tests.accelerators import ddp_model, DDPLauncher from tests.utilities.distributed import call_training_script diff --git a/tests/accelerators/legacy/test_ddp_spawn.py b/tests/accelerators/test_ddp_spawn.py similarity index 100% rename from tests/accelerators/legacy/test_ddp_spawn.py rename to tests/accelerators/test_ddp_spawn.py diff --git a/tests/accelerators/legacy/test_dp.py b/tests/accelerators/test_dp.py similarity index 100% rename from tests/accelerators/legacy/test_dp.py rename to tests/accelerators/test_dp.py diff --git a/tests/accelerators/legacy/test_multi_nodes_gpu.py b/tests/accelerators/test_multi_nodes_gpu.py similarity index 100% rename from tests/accelerators/legacy/test_multi_nodes_gpu.py rename to tests/accelerators/test_multi_nodes_gpu.py diff --git a/tests/accelerators/legacy/test_tpu_backend.py b/tests/accelerators/test_tpu_backend.py similarity index 100% rename from tests/accelerators/legacy/test_tpu_backend.py rename to tests/accelerators/test_tpu_backend.py diff --git a/tests/trainer/properties/test_get_model.py b/tests/trainer/properties/test_get_model.py index 37e495f7e5214..73e900072b7e0 100644 --- a/tests/trainer/properties/test_get_model.py +++ b/tests/trainer/properties/test_get_model.py @@ -17,7 +17,7 @@ import torch from pytorch_lightning import Trainer -from tests.accelerators.legacy import DDPLauncher +from tests.accelerators import DDPLauncher from tests.helpers.boring_model import BoringModel