From 089fcb91a05fbe189da2c6c5afe397669eb6a055 Mon Sep 17 00:00:00 2001 From: Kaushik B <45285388+kaushikb11@users.noreply.github.com> Date: Fri, 25 Mar 2022 10:50:22 +0530 Subject: [PATCH] Collect and run all IPU tests (#11170) * Collect and run all ipu tests * Update azure pipeline * Increase pytest verbosity * Update RunIf Co-authored-by: Akihiro Nitta --- .azure-pipelines/ipu-tests.yml | 3 ++- tests/conftest.py | 8 ++++++++ tests/helpers/runif.py | 4 +++- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/.azure-pipelines/ipu-tests.yml b/.azure-pipelines/ipu-tests.yml index ad9cd8623a..caa3df86a7 100644 --- a/.azure-pipelines/ipu-tests.yml +++ b/.azure-pipelines/ipu-tests.yml @@ -76,7 +76,8 @@ jobs: source ${{ variables.poplar_sdk }}/poplar-ubuntu*/enable.sh source ${{ variables.poplar_sdk }}/popart-ubuntu*/enable.sh export POPTORCH_WAIT_FOR_IPU=1 - python -m coverage run --source pytorch_lightning -m pytest tests/accelerators/test_ipu.py -v --junitxml=$(Build.StagingDirectory)/test-results.xml --durations=50 + export PL_RUN_IPU_TESTS=1 + python -m coverage run --source pytorch_lightning -m pytest tests -vv --junitxml=$(Build.StagingDirectory)/test-results.xml --durations=50 env: MKL_THREADING_LAYER: "GNU" displayName: 'Testing: standard' diff --git a/tests/conftest.py b/tests/conftest.py index 16e7f22bd3..cdb1bfbd39 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -190,3 +190,11 @@ def pytest_collection_modifyitems(items): # has `@RunIf(slow=True)` if marker.name == "skipif" and marker.kwargs.get("slow") ] + elif os.getenv("PL_RUN_IPU_TESTS", "0") == "1": + items[:] = [ + item + for item in items + for marker in item.own_markers + # has `@RunIf(ipu=True)` + if marker.name == "skipif" and marker.kwargs.get("ipu") + ] diff --git a/tests/helpers/runif.py b/tests/helpers/runif.py index b81a1b1fdf..f52aada92e 100644 --- a/tests/helpers/runif.py +++ b/tests/helpers/runif.py @@ -149,8 +149,10 @@ class RunIf: reasons.append("TPU") if ipu: - conditions.append(not _IPU_AVAILABLE) + env_flag = os.getenv("PL_RUN_IPU_TESTS", "0") + conditions.append(env_flag != "1" or not _IPU_AVAILABLE) reasons.append("IPU") + kwargs["ipu"] = True if horovod: conditions.append(not _HOROVOD_AVAILABLE)