From 7ce69b2658701eaa9fcdc6d118549c172fd5104e Mon Sep 17 00:00:00 2001 From: Andrey Talman Date: Wed, 14 Jun 2023 18:24:43 -0400 Subject: [PATCH] smoke test poetry (#1428) Add a little more tests test Test poetry test Test poetry on python 3.10 Add more poetry tests Test en us test test Try verboose testing testing try quiet install Code refactooring test move linux pipy validation to workflow test test Fix path try test pipy More torch installations test testing test test test new fix install 2 try poetry nightly test nightly test test Test poetry validation test test_new test Put back executing this on pull Print matrix variable test Fix conditional for pypi poetry tests add quptes Add nightly as supplemental requirement Make sure we clone module only for first time Fix python test validate binaries Add repo existance checks test Disable runtime error before final validation fix typo fix cwd --- .github/scripts/validate_poetry.sh | 3 ++- .github/workflows/validate-linux-binaries.yml | 9 ++++---- test/smoke_test/smoke_test.py | 22 ++++++++++++++----- 3 files changed, 24 insertions(+), 10 deletions(-) diff --git a/.github/scripts/validate_poetry.sh b/.github/scripts/validate_poetry.sh index 344a7a85f..6a6d7b366 100644 --- a/.github/scripts/validate_poetry.sh +++ b/.github/scripts/validate_poetry.sh @@ -12,7 +12,8 @@ if [[ ${MATRIX_CHANNEL} != "release" ]]; then # Installing poetry from our custom repo. We need to configure it before use and disable authentication export PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring poetry source add --priority=explicit domains "https://download.pytorch.org/whl/${MATRIX_CHANNEL}/${MATRIX_DESIRED_CUDA}" - poetry source add --priority=explicit pytorch "https://download.pytorch.org/whl/${MATRIX_CHANNEL}/${MATRIX_DESIRED_CUDA}_pypi_cudnn" + poetry source add --priority=supplemental pytorch-nightly "https://download.pytorch.org/whl/${MATRIX_CHANNEL}" + poetry source add --priority=supplemental pytorch "https://download.pytorch.org/whl/${MATRIX_CHANNEL}/${MATRIX_DESIRED_CUDA}_pypi_cudnn" poetry --quiet add --source pytorch torch poetry --quiet add --source domains torchvision torchaudio else diff --git a/.github/workflows/validate-linux-binaries.yml b/.github/workflows/validate-linux-binaries.yml index b20b10ea1..e33d89fb6 100644 --- a/.github/workflows/validate-linux-binaries.yml +++ b/.github/workflows/validate-linux-binaries.yml @@ -58,10 +58,11 @@ jobs: # Special case PyPi installation package. And Install of PyPi package via poetry if [[ ${MATRIX_PACKAGE_TYPE} == "manywheel" ]] && \ - {[${MATRIX_GPU_ARCH_VERSION} == "12.1" && ${MATRIX_CHANNEL} != "release"] || \ - [${MATRIX_GPU_ARCH_VERSION} == "11.7" && ${MATRIX_CHANNEL} == "release"]}; then - source ./.github/scripts/validate_pipy.sh - source ./.github/scripts/validate_poetry.sh + ([[ ${MATRIX_GPU_ARCH_VERSION} == "12.1" && ${MATRIX_CHANNEL} != "release" ]] || \ + [[ ${MATRIX_GPU_ARCH_VERSION} == "11.7" && ${MATRIX_CHANNEL} == "release" ]]); then + source ./.github/scripts/validate_pipy.sh --runtime-error-check disabled + source ./.github/scripts/validate_poetry.sh --runtime-error-check disabled fi + # Standart case: Validate binaries source ./.github/scripts/validate_binaries.sh diff --git a/test/smoke_test/smoke_test.py b/test/smoke_test/smoke_test.py index 1a55cfed7..34aaabb8e 100644 --- a/test/smoke_test/smoke_test.py +++ b/test/smoke_test/smoke_test.py @@ -18,7 +18,6 @@ package_type = os.getenv("MATRIX_PACKAGE_TYPE") is_cuda_system = gpu_arch_type == "cuda" -SCRIPT_DIR = Path(__file__).parent NIGHTLY_ALLOWED_DELTA = 3 MODULES = [ @@ -27,12 +26,14 @@ "repo": "https://github.com/pytorch/vision.git", "smoke_test": "python ./vision/test/smoke_test.py", "extension": "extension", + "repo_name": "vision", }, { "name": "torchaudio", "repo": "https://github.com/pytorch/audio.git", "smoke_test": "python ./audio/test/smoke_test/smoke_test.py --no-ffmpeg", "extension": "_extension", + "repo_name": "audio", }, ] @@ -100,7 +101,7 @@ def test_cuda_runtime_errors_captured() -> None: if(cuda_exception_missed): raise RuntimeError( f"Expected CUDA RuntimeError but have not received!") -def smoke_test_cuda(package: str) -> None: +def smoke_test_cuda(package: str, runtime_error_check: str) -> None: if not torch.cuda.is_available() and is_cuda_system: raise RuntimeError(f"Expected CUDA {gpu_arch_ver}. However CUDA is not loaded.") @@ -130,7 +131,8 @@ def smoke_test_cuda(package: str) -> None: if (sys.platform == "linux" or sys.platform == "linux2") and sys.version_info < (3, 11, 0): smoke_test_compile() - test_cuda_runtime_errors_captured() + if(runtime_error_check == "enabled"): + test_cuda_runtime_errors_captured() def smoke_test_conv2d() -> None: @@ -203,9 +205,12 @@ def foo(x: torch.Tensor) -> torch.Tensor: x_pt2 = torch.compile(model, mode="max-autotune")(x) def smoke_test_modules(): + cwd = os.getcwd() for module in MODULES: if module["repo"]: - subprocess.check_output(f"git clone --depth 1 {module['repo']}", stderr=subprocess.STDOUT, shell=True) + if not os.path.exists(f"{cwd}/{module['repo_name']}"): + print(f"Path does not exist: {cwd}/{module['repo_name']}") + subprocess.check_output(f"git clone --depth 1 {module['repo']}", stderr=subprocess.STDOUT, shell=True) try: output = subprocess.check_output( module["smoke_test"], stderr=subprocess.STDOUT, shell=True, @@ -227,6 +232,13 @@ def main() -> None: choices=["all", "torchonly"], default="all", ) + parser.add_argument( + "--runtime-error-check", + help="No Runtime Error check", + type=str, + choices=["enabled", "disabled"], + default="enabled", + ) options = parser.parse_args() print(f"torch: {torch.__version__}") check_version(options.package) @@ -236,7 +248,7 @@ def main() -> None: if options.package == "all": smoke_test_modules() - smoke_test_cuda(options.package) + smoke_test_cuda(options.package, options.runtime_error_check) if __name__ == "__main__":