diff --git a/test/auto_parallel/CMakeLists.txt b/test/auto_parallel/CMakeLists.txt index caaa08832f0a0..e46667302a9de 100644 --- a/test/auto_parallel/CMakeLists.txt +++ b/test/auto_parallel/CMakeLists.txt @@ -9,20 +9,6 @@ add_subdirectory(pir) if(WITH_DISTRIBUTE AND WITH_GPU) # NOTE(zyl): unittests WITH multi cards and timeout - py_test_modules(test_auto_parallel_relaunch MODULES - test_auto_parallel_relaunch) - set_tests_properties(test_auto_parallel_relaunch - PROPERTIES LABELS "RUN_TYPE=EXCLUSIVE" TIMEOUT 120) - py_test_modules(test_engine_api MODULES test_engine_api) - set_tests_properties(test_engine_api PROPERTIES LABELS "RUN_TYPE=EXCLUSIVE" - TIMEOUT 80) - py_test_modules(test_engine_api_dp MODULES test_engine_api_dp) - set_tests_properties(test_engine_api_dp - PROPERTIES LABELS "RUN_TYPE=EXCLUSIVE" TIMEOUT 80) - py_test_modules(test_optimization_tuner_api MODULES - test_optimization_tuner_api) - set_tests_properties(test_optimization_tuner_api - PROPERTIES LABELS "RUN_TYPE=EXCLUSIVE" TIMEOUT 120) py_test_modules(test_converter MODULES test_converter) set_tests_properties(test_converter PROPERTIES LABELS "RUN_TYPE=EXCLUSIVE" TIMEOUT 50) @@ -33,13 +19,6 @@ if(WITH_DISTRIBUTE AND WITH_GPU) set_tests_properties(test_iterable_dataset PROPERTIES LABELS "RUN_TYPE=EXCLUSIVE" TIMEOUT 80) - py_test_modules(test_auto_tuner MODULES test_auto_tuner) - set_tests_properties(test_auto_tuner PROPERTIES LABELS "RUN_TYPE=EXCLUSIVE" - TIMEOUT 100) - py_test_modules(test_auto_tuner_compare MODULES test_auto_tuner_compare) - set_tests_properties(test_auto_tuner_compare - PROPERTIES LABELS "RUN_TYPE=EXCLUSIVE" TIMEOUT 100) - py_test_modules(test_reshard_api MODULES test_reshard_api) set_tests_properties(test_reshard_api PROPERTIES LABELS "RUN_TYPE=EXCLUSIVE" TIMEOUT 150) diff --git a/test/deprecated/auto_parallel/CMakeLists.txt b/test/deprecated/auto_parallel/CMakeLists.txt index 8a02694e524ae..81eafe88244a1 100644 --- a/test/deprecated/auto_parallel/CMakeLists.txt +++ b/test/deprecated/auto_parallel/CMakeLists.txt @@ -7,7 +7,28 @@ # add_subdirectory(pir) if(WITH_DISTRIBUTE AND WITH_GPU) - + py_test_modules(test_auto_parallel_relaunch_deprecated MODULES + test_auto_parallel_relaunch_deprecated) + set_tests_properties(test_auto_parallel_relaunch_deprecated + PROPERTIES LABELS "RUN_TYPE=EXCLUSIVE" TIMEOUT 120) + py_test_modules(test_engine_api_dp_deprecated MODULES + test_engine_api_dp_deprecated) + set_tests_properties(test_engine_api_dp_deprecated + PROPERTIES LABELS "RUN_TYPE=EXCLUSIVE" TIMEOUT 80) + py_test_modules(test_engine_api_deprecated MODULES test_engine_api_deprecated) + set_tests_properties(test_engine_api_deprecated + PROPERTIES LABELS "RUN_TYPE=EXCLUSIVE" TIMEOUT 80) + py_test_modules(test_auto_tuner_compare_deprecated MODULES + test_auto_tuner_compare_deprecated) + set_tests_properties(test_auto_tuner_compare_deprecated + PROPERTIES LABELS "RUN_TYPE=EXCLUSIVE" TIMEOUT 100) + py_test_modules(test_auto_tuner_deprecated MODULES test_auto_tuner_deprecated) + set_tests_properties(test_auto_tuner_deprecated + PROPERTIES LABELS "RUN_TYPE=EXCLUSIVE" TIMEOUT 100) + py_test_modules(test_optimization_tuner_api_deprecated MODULES + test_optimization_tuner_api_deprecated) + set_tests_properties(test_optimization_tuner_api_deprecated + PROPERTIES LABELS "RUN_TYPE=EXCLUSIVE" TIMEOUT 120) py_test_modules(test_relaunch_with_planner_deprecated MODULES test_relaunch_with_planner_deprecated) set_tests_properties(test_relaunch_with_planner_deprecated diff --git a/test/auto_parallel/auto_parallel_relaunch_model.py b/test/deprecated/auto_parallel/auto_parallel_relaunch_model.py similarity index 100% rename from test/auto_parallel/auto_parallel_relaunch_model.py rename to test/deprecated/auto_parallel/auto_parallel_relaunch_model.py diff --git a/test/auto_parallel/engine_api.py b/test/deprecated/auto_parallel/engine_api_deprecated.py similarity index 100% rename from test/auto_parallel/engine_api.py rename to test/deprecated/auto_parallel/engine_api_deprecated.py diff --git a/test/auto_parallel/engine_api_dp.py b/test/deprecated/auto_parallel/engine_api_dp_deprecated.py similarity index 100% rename from test/auto_parallel/engine_api_dp.py rename to test/deprecated/auto_parallel/engine_api_dp_deprecated.py diff --git a/test/deprecated/auto_parallel/launch.py b/test/deprecated/auto_parallel/launch.py new file mode 100644 index 0000000000000..d312a82073173 --- /dev/null +++ b/test/deprecated/auto_parallel/launch.py @@ -0,0 +1,23 @@ +# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import os + +from paddle.distributed.fleet import launch +from paddle.distributed.fleet.launch_utils import run_with_coverage + +if __name__ == "__main__": + if os.environ.get("WITH_COVERAGE", "OFF") == "ON": + run_with_coverage(True) + launch.launch() diff --git a/test/auto_parallel/optimization_tuner_api.py b/test/deprecated/auto_parallel/optimization_tuner_api_deprecated.py similarity index 98% rename from test/auto_parallel/optimization_tuner_api.py rename to test/deprecated/auto_parallel/optimization_tuner_api_deprecated.py index 2cf3326e9b220..b88e7f2f2410a 100644 --- a/test/auto_parallel/optimization_tuner_api.py +++ b/test/deprecated/auto_parallel/optimization_tuner_api_deprecated.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -from engine_api_dp import MyDataset +from engine_api_dp_deprecated import MyDataset import paddle import paddle.nn.functional as F diff --git a/test/deprecated/auto_parallel/pipeline_scheduler_zb_unittest_deprecated.py b/test/deprecated/auto_parallel/pipeline_scheduler_zb_unittest_deprecated.py index 3f41b43ec0f38..3c98b1f17bf31 100644 --- a/test/deprecated/auto_parallel/pipeline_scheduler_zb_unittest_deprecated.py +++ b/test/deprecated/auto_parallel/pipeline_scheduler_zb_unittest_deprecated.py @@ -19,6 +19,7 @@ import numpy as np sys.path.append("../../auto_parallel") + from get_gpt_model import FakeDataset, generate_model import paddle diff --git a/test/deprecated/auto_parallel/recompute_pass_unittest_deprecated.py b/test/deprecated/auto_parallel/recompute_pass_unittest_deprecated.py index f913f001f9667..7647af7464c36 100644 --- a/test/deprecated/auto_parallel/recompute_pass_unittest_deprecated.py +++ b/test/deprecated/auto_parallel/recompute_pass_unittest_deprecated.py @@ -19,6 +19,7 @@ import numpy as np sys.path.append("../../auto_parallel") + from get_gpt_model import FakeDataset, generate_model import paddle diff --git a/test/auto_parallel/test_auto_parallel_relaunch.py b/test/deprecated/auto_parallel/test_auto_parallel_relaunch_deprecated.py similarity index 100% rename from test/auto_parallel/test_auto_parallel_relaunch.py rename to test/deprecated/auto_parallel/test_auto_parallel_relaunch_deprecated.py diff --git a/test/auto_parallel/test_auto_tuner_compare.py b/test/deprecated/auto_parallel/test_auto_tuner_compare_deprecated.py similarity index 96% rename from test/auto_parallel/test_auto_tuner_compare.py rename to test/deprecated/auto_parallel/test_auto_tuner_compare_deprecated.py index 430580891c8c6..872cafb7856ae 100644 --- a/test/auto_parallel/test_auto_tuner_compare.py +++ b/test/deprecated/auto_parallel/test_auto_tuner_compare_deprecated.py @@ -23,7 +23,9 @@ class TestEngineAPI(unittest.TestCase): def test_auto_tuner_compare(self): file_dir = os.path.dirname(os.path.abspath(__file__)) - launch_model_path = os.path.join(file_dir, "engine_api_dp.py") + launch_model_path = os.path.join( + file_dir, "engine_api_dp_deprecated.py" + ) if os.environ.get("WITH_COVERAGE", "OFF") == "ON": coverage_args = ["-m", "coverage", "run", "--branch", "-p"] diff --git a/test/auto_parallel/test_auto_tuner.py b/test/deprecated/auto_parallel/test_auto_tuner_deprecated.py similarity index 96% rename from test/auto_parallel/test_auto_tuner.py rename to test/deprecated/auto_parallel/test_auto_tuner_deprecated.py index 597997a7766fc..ea66a3780d087 100644 --- a/test/auto_parallel/test_auto_tuner.py +++ b/test/deprecated/auto_parallel/test_auto_tuner_deprecated.py @@ -23,7 +23,9 @@ class TestEngineAPI(unittest.TestCase): def test_auto_tuner(self): file_dir = os.path.dirname(os.path.abspath(__file__)) - launch_model_path = os.path.join(file_dir, "engine_api_dp.py") + launch_model_path = os.path.join( + file_dir, "engine_api_dp_deprecated.py" + ) if os.environ.get("WITH_COVERAGE", "OFF") == "ON": coverage_args = ["-m", "coverage", "run", "--branch", "-p"] diff --git a/test/auto_parallel/test_engine_api_dp.py b/test/deprecated/auto_parallel/test_engine_api_deprecated.py similarity index 99% rename from test/auto_parallel/test_engine_api_dp.py rename to test/deprecated/auto_parallel/test_engine_api_deprecated.py index 007134b9a4ff6..16281cb023a99 100644 --- a/test/auto_parallel/test_engine_api_dp.py +++ b/test/deprecated/auto_parallel/test_engine_api_deprecated.py @@ -22,7 +22,7 @@ class TestEngineAPI(unittest.TestCase): def test_engine_api(self): file_dir = os.path.dirname(os.path.abspath(__file__)) - launch_model_path = os.path.join(file_dir, "engine_api_dp.py") + launch_model_path = os.path.join(file_dir, "engine_api_deprecated.py") if os.environ.get("WITH_COVERAGE", "OFF") == "ON": coverage_args = ["-m", "coverage", "run", "--branch", "-p"] diff --git a/test/auto_parallel/test_engine_api.py b/test/deprecated/auto_parallel/test_engine_api_dp_deprecated.py similarity index 93% rename from test/auto_parallel/test_engine_api.py rename to test/deprecated/auto_parallel/test_engine_api_dp_deprecated.py index 63bea6eeeff33..b6973dbae2c5c 100644 --- a/test/auto_parallel/test_engine_api.py +++ b/test/deprecated/auto_parallel/test_engine_api_dp_deprecated.py @@ -22,7 +22,9 @@ class TestEngineAPI(unittest.TestCase): def test_engine_api(self): file_dir = os.path.dirname(os.path.abspath(__file__)) - launch_model_path = os.path.join(file_dir, "engine_api.py") + launch_model_path = os.path.join( + file_dir, "engine_api_dp_deprecated.py" + ) if os.environ.get("WITH_COVERAGE", "OFF") == "ON": coverage_args = ["-m", "coverage", "run", "--branch", "-p"] diff --git a/test/deprecated/auto_parallel/test_mp_allreduce_matmul_grad_overlapping_deprecated.py b/test/deprecated/auto_parallel/test_mp_allreduce_matmul_grad_overlapping_deprecated.py index 118e560a16425..82315831e9f42 100644 --- a/test/deprecated/auto_parallel/test_mp_allreduce_matmul_grad_overlapping_deprecated.py +++ b/test/deprecated/auto_parallel/test_mp_allreduce_matmul_grad_overlapping_deprecated.py @@ -23,7 +23,8 @@ class TestMPAllreduceMatmulGradOverlapping(unittest.TestCase): def test_mp_allreduce_matmul_grad_overlapping(self): file_dir = os.path.dirname(os.path.abspath(__file__)) launch_model_path = os.path.join( - file_dir, "mp_allreduce_matmul_grad_overlapping_unittest.py" + file_dir, + "mp_allreduce_matmul_grad_overlapping_unittest.py", ) if os.environ.get("WITH_COVERAGE", "OFF") == "ON": diff --git a/test/auto_parallel/test_optimization_tuner_api.py b/test/deprecated/auto_parallel/test_optimization_tuner_api_deprecated.py similarity index 93% rename from test/auto_parallel/test_optimization_tuner_api.py rename to test/deprecated/auto_parallel/test_optimization_tuner_api_deprecated.py index 7690ae7f095ee..d8307bd903aa3 100644 --- a/test/auto_parallel/test_optimization_tuner_api.py +++ b/test/deprecated/auto_parallel/test_optimization_tuner_api_deprecated.py @@ -23,7 +23,9 @@ class TestOptimizationTunerAPI(unittest.TestCase): def test_engine_api(self): file_dir = os.path.dirname(os.path.abspath(__file__)) - launch_model_path = os.path.join(file_dir, "optimization_tuner_api.py") + launch_model_path = os.path.join( + file_dir, "optimization_tuner_api_deprecated.py" + ) if os.environ.get("WITH_COVERAGE", "OFF") == "ON": coverage_args = ["-m", "coverage", "run", "--branch", "-p"] diff --git a/test/deprecated/auto_parallel/test_relaunch_with_planner_deprecated.py b/test/deprecated/auto_parallel/test_relaunch_with_planner_deprecated.py index 7b8c049c9ea7b..aa925e1cd367c 100644 --- a/test/deprecated/auto_parallel/test_relaunch_with_planner_deprecated.py +++ b/test/deprecated/auto_parallel/test_relaunch_with_planner_deprecated.py @@ -30,7 +30,10 @@ def tearDown(self): self.temp_dir.cleanup() def test_relaunch_with_planner(self): - from test_auto_parallel_relaunch import cluster_json, mapping_json + from test_auto_parallel_relaunch_deprecated import ( + cluster_json, + mapping_json, + ) cluster_json_path = os.path.join( self.temp_dir.name, "auto_parallel_cluster.json"