From ae11dd3a13f0fec493636e71a3d607d60962c017 Mon Sep 17 00:00:00 2001 From: atalman <atalman@fb.com> Date: Mon, 6 Mar 2023 14:07:40 -0800 Subject: [PATCH 01/21] Add smoke tests conv,linalg,compile --- test/smoke_test/smoke_test.py | 52 +++++++++++++++++++++++++++++++++-- 1 file changed, 49 insertions(+), 3 deletions(-) diff --git a/test/smoke_test/smoke_test.py b/test/smoke_test/smoke_test.py index a271a5a3e..bc9773e0d 100644 --- a/test/smoke_test/smoke_test.py +++ b/test/smoke_test/smoke_test.py @@ -95,6 +95,9 @@ def smoke_test_cuda(package: str) -> None: print(f"torch cudnn: {torch.backends.cudnn.version()}") print(f"cuDNN enabled? {torch.backends.cudnn.enabled}") + if sys.platform == "linux" or sys.platform == "linux2": + smoke_test_compile() + # This check has to be run last, since its messing up CUDA runtime test_cuda_runtime_errors_captured() @@ -102,15 +105,16 @@ def smoke_test_cuda(package: str) -> None: def smoke_test_conv2d() -> None: import torch.nn as nn - print("Calling smoke_test_conv2d") + print("Testing smoke_test_conv2d") # With square kernels and equal stride m = nn.Conv2d(16, 33, 3, stride=2) # non-square kernels and unequal stride and with padding m = nn.Conv2d(16, 33, (3, 5), stride=(2, 1), padding=(4, 2)) # non-square kernels and unequal stride and with padding and dilation - m = nn.Conv2d(16, 33, (3, 5), stride=(2, 1), padding=(4, 2), dilation=(3, 1)) + basic_conv = nn.Conv2d(16, 33, (3, 5), stride=(2, 1), padding=(4, 2), dilation=(3, 1)) input = torch.randn(20, 16, 50, 100) - output = m(input) + output = basic_conv(input) + if is_cuda_system: print("Testing smoke_test_conv2d with cuda") conv = nn.Conv2d(3, 3, 3).cuda() @@ -118,6 +122,46 @@ def smoke_test_conv2d() -> None: with torch.cuda.amp.autocast(): out = conv(x) + supported_dtypes = [torch.float16, torch.float32, torch.float64] + for dtype in supported_dtypes: + print(f"Testing smoke_test_conv2d with cuda for {dtype}") + conv = basic_conv.to(dtype).cuda() + input = torch.randn(20, 16, 50, 100, device="cuda").type(dtype) + output = conv(input) + +def smoke_test_linalg() -> None: + print("Testing smoke_test_linalg") + A = torch.randn(5, 3) + U, S, Vh = torch.linalg.svd(A, full_matrices=False) + U.shape, S.shape, Vh.shape + torch.dist(A, U @ torch.diag(S) @ Vh) + + U, S, Vh = torch.linalg.svd(A) + U.shape, S.shape, Vh.shape + torch.dist(A, U[:, :3] @ torch.diag(S) @ Vh) + + A = torch.randn(7, 5, 3) + U, S, Vh = torch.linalg.svd(A, full_matrices=False) + torch.dist(A, U @ torch.diag_embed(S) @ Vh) + + if is_cuda_system: + supported_dtypes = [torch.float32, torch.float64] + for dtype in supported_dtypes: + print(f"Testing smoke_test_linalg with cuda for {dtype}") + A = torch.randn(20, 16, 50, 100, device="cuda").type(dtype) + torch.linalg.svd(A) + +def smoke_test_compile() -> None: + supported_dtypes = [torch.float16, torch.float32, torch.float64] + def foo(x: torch.Tensor) -> torch.Tensor: + return torch.sin(x) + torch.cos(x) + for dtype in supported_dtypes: + print(f"Testing smoke_test_compile for {dtype}") + x = torch.rand(3, 3, device="cuda").type(dtype) + x_eager = foo(x) + x_pt2 = torch.compile(foo)(x) + print(torch.allclose(x_eager, x_pt2)) + def smoke_test_modules(): for module in MODULES: @@ -147,6 +191,8 @@ def main() -> None: options = parser.parse_args() print(f"torch: {torch.__version__}") smoke_test_conv2d() + smoke_test_linalg() + if options.package == "all": smoke_test_modules() From 7b1bf7a0c6bd8b2cdc8d50d7d981e7d674f633d7 Mon Sep 17 00:00:00 2001 From: atalman <atalman@fb.com> Date: Mon, 6 Mar 2023 14:30:55 -0800 Subject: [PATCH 02/21] Add version check --- .../workflows/validate-nightly-binaries.yml | 4 ++-- test/smoke_test/smoke_test.py | 21 ++++++++++++------- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/.github/workflows/validate-nightly-binaries.yml b/.github/workflows/validate-nightly-binaries.yml index c252e0433..3ae05cc32 100644 --- a/.github/workflows/validate-nightly-binaries.yml +++ b/.github/workflows/validate-nightly-binaries.yml @@ -30,6 +30,6 @@ jobs: nightly: uses: ./.github/workflows/validate-binaries.yml with: - channel: nightly + channel: test os: all - limit-win-builds: enable + limit-win-builds: disable diff --git a/test/smoke_test/smoke_test.py b/test/smoke_test/smoke_test.py index bc9773e0d..2dbfbb93e 100644 --- a/test/smoke_test/smoke_test.py +++ b/test/smoke_test/smoke_test.py @@ -10,8 +10,9 @@ gpu_arch_ver = os.getenv("MATRIX_GPU_ARCH_VERSION") gpu_arch_type = os.getenv("MATRIX_GPU_ARCH_TYPE") -# use installation env variable to tell if it is nightly channel -installation_str = os.getenv("MATRIX_INSTALLATION") +channel = os.getenv("MATRIX_CHANNEL") +stable_version = os.getenv("MATRIX_STABLE_VERSION") + is_cuda_system = gpu_arch_type == "cuda" SCRIPT_DIR = Path(__file__).parent NIGHTLY_ALLOWED_DELTA = 3 @@ -31,6 +32,16 @@ }, ] +def check_version(package: str) -> None: + # only makes sense to check nightly package where dates are known + if channel == "nightly": + check_nightly_binaries_date(options.package) + else + if torch.__version__ != stable_version: + raise RuntimeError( + f"Torch version mismatch, expected {stable_version} for channel {channel}. But its {torch.__version__}" + ) + def check_nightly_binaries_date(package: str) -> None: from datetime import datetime, timedelta format_dt = '%Y%m%d' @@ -190,17 +201,13 @@ def main() -> None: ) options = parser.parse_args() print(f"torch: {torch.__version__}") + check_version(options.package) smoke_test_conv2d() smoke_test_linalg() - if options.package == "all": smoke_test_modules() - # only makes sense to check nightly package where dates are known - if installation_str.find("nightly") != -1: - check_nightly_binaries_date(options.package) - smoke_test_cuda(options.package) From ebdbead9bbe8db12694397d0fd7e4a30785eea24 Mon Sep 17 00:00:00 2001 From: atalman <atalman@fb.com> Date: Mon, 6 Mar 2023 14:34:32 -0800 Subject: [PATCH 03/21] Fix typo Fix version check Add not --- test/smoke_test/smoke_test.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/smoke_test/smoke_test.py b/test/smoke_test/smoke_test.py index 2dbfbb93e..449ee0706 100644 --- a/test/smoke_test/smoke_test.py +++ b/test/smoke_test/smoke_test.py @@ -36,8 +36,8 @@ def check_version(package: str) -> None: # only makes sense to check nightly package where dates are known if channel == "nightly": check_nightly_binaries_date(options.package) - else - if torch.__version__ != stable_version: + else: + if not torch.__version__.startswith(stable_version): raise RuntimeError( f"Torch version mismatch, expected {stable_version} for channel {channel}. But its {torch.__version__}" ) From f05540831b26b64401be5f4c476f777a86b74643 Mon Sep 17 00:00:00 2001 From: atalman <atalman@fb.com> Date: Mon, 6 Mar 2023 15:00:38 -0800 Subject: [PATCH 04/21] Add exception for python 3.11 --- test/smoke_test/smoke_test.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/smoke_test/smoke_test.py b/test/smoke_test/smoke_test.py index 449ee0706..bad21e39f 100644 --- a/test/smoke_test/smoke_test.py +++ b/test/smoke_test/smoke_test.py @@ -106,7 +106,8 @@ def smoke_test_cuda(package: str) -> None: print(f"torch cudnn: {torch.backends.cudnn.version()}") print(f"cuDNN enabled? {torch.backends.cudnn.enabled}") - if sys.platform == "linux" or sys.platform == "linux2": + # torch.compile is available only on Linux and python 3.8-3.10 + if (sys.platform == "linux" or sys.platform == "linux2") and sys.version_info < (3, 11, 0):: smoke_test_compile() # This check has to be run last, since its messing up CUDA runtime From 682704ff6c9b2a8019e6b04ab36b82ab1a5ce4d3 Mon Sep 17 00:00:00 2001 From: atalman <atalman@fb.com> Date: Mon, 6 Mar 2023 15:06:28 -0800 Subject: [PATCH 05/21] fix typo --- test/smoke_test/smoke_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/smoke_test/smoke_test.py b/test/smoke_test/smoke_test.py index bad21e39f..f242a02e3 100644 --- a/test/smoke_test/smoke_test.py +++ b/test/smoke_test/smoke_test.py @@ -107,7 +107,7 @@ def smoke_test_cuda(package: str) -> None: print(f"cuDNN enabled? {torch.backends.cudnn.enabled}") # torch.compile is available only on Linux and python 3.8-3.10 - if (sys.platform == "linux" or sys.platform == "linux2") and sys.version_info < (3, 11, 0):: + if (sys.platform == "linux" or sys.platform == "linux2") and sys.version_info < (3, 11, 0): smoke_test_compile() # This check has to be run last, since its messing up CUDA runtime From 23d315279d8a0118c958633e4a4bc779228dbf05 Mon Sep 17 00:00:00 2001 From: atalman <atalman@fb.com> Date: Mon, 6 Mar 2023 15:34:18 -0800 Subject: [PATCH 06/21] Try to exit after CUDA Runtime exception --- test/smoke_test/smoke_test.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/smoke_test/smoke_test.py b/test/smoke_test/smoke_test.py index f242a02e3..57d39f169 100644 --- a/test/smoke_test/smoke_test.py +++ b/test/smoke_test/smoke_test.py @@ -69,12 +69,14 @@ def check_nightly_binaries_date(package: str) -> None: def test_cuda_runtime_errors_captured() -> None: cuda_exception_missed=True try: + print("Testing test_cuda_runtime_errors_captured") torch._assert_async(torch.tensor(0, device="cuda")) torch._assert_async(torch.tensor(0 + 0j, device="cuda")) except RuntimeError as e: if re.search("CUDA", f"{e}"): print(f"Caught CUDA exception with success: {e}") - cuda_exception_missed = False + # we want to terminate at this point, since we can't guaranee further execution + exit(0) else: raise e if(cuda_exception_missed): From f29963c5376e3f260a534c5cd218a3be42e0c538 Mon Sep 17 00:00:00 2001 From: atalman <atalman@fb.com> Date: Mon, 6 Mar 2023 16:15:05 -0800 Subject: [PATCH 07/21] Restrict carsh test only to conda --- test/smoke_test/smoke_test.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/test/smoke_test/smoke_test.py b/test/smoke_test/smoke_test.py index 57d39f169..a510ea635 100644 --- a/test/smoke_test/smoke_test.py +++ b/test/smoke_test/smoke_test.py @@ -12,6 +12,7 @@ gpu_arch_type = os.getenv("MATRIX_GPU_ARCH_TYPE") channel = os.getenv("MATRIX_CHANNEL") stable_version = os.getenv("MATRIX_STABLE_VERSION") +package_type = os.getenv("MATRIX_PACKAGE_TYPE") is_cuda_system = gpu_arch_type == "cuda" SCRIPT_DIR = Path(__file__).parent @@ -75,8 +76,6 @@ def test_cuda_runtime_errors_captured() -> None: except RuntimeError as e: if re.search("CUDA", f"{e}"): print(f"Caught CUDA exception with success: {e}") - # we want to terminate at this point, since we can't guaranee further execution - exit(0) else: raise e if(cuda_exception_missed): @@ -112,8 +111,11 @@ 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() - # This check has to be run last, since its messing up CUDA runtime - test_cuda_runtime_errors_captured() + # This check has to be run last, since its messing up CUDA runtime. + # Restrict only to conda builds since Wheel seems to crash with + # segmentation fault and don't recover + if(package_type == 'conda') + test_cuda_runtime_errors_captured() def smoke_test_conv2d() -> None: From 92e7f57c39861ea1cc2d8270ce7b2bea769e2cd3 Mon Sep 17 00:00:00 2001 From: atalman <atalman@fb.com> Date: Mon, 6 Mar 2023 16:18:25 -0800 Subject: [PATCH 08/21] Restrict carsh test only to conda --- test/smoke_test/smoke_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/smoke_test/smoke_test.py b/test/smoke_test/smoke_test.py index a510ea635..1b560596e 100644 --- a/test/smoke_test/smoke_test.py +++ b/test/smoke_test/smoke_test.py @@ -114,7 +114,7 @@ def smoke_test_cuda(package: str) -> None: # This check has to be run last, since its messing up CUDA runtime. # Restrict only to conda builds since Wheel seems to crash with # segmentation fault and don't recover - if(package_type == 'conda') + if(package_type == 'conda'): test_cuda_runtime_errors_captured() From 36af800e55b22e28b312dc5165a4b4b350e107ed Mon Sep 17 00:00:00 2001 From: atalman <atalman@fb.com> Date: Mon, 6 Mar 2023 16:33:09 -0800 Subject: [PATCH 09/21] Fix tests --- test/smoke_test/smoke_test.py | 1 + 1 file changed, 1 insertion(+) diff --git a/test/smoke_test/smoke_test.py b/test/smoke_test/smoke_test.py index 1b560596e..1ddda1886 100644 --- a/test/smoke_test/smoke_test.py +++ b/test/smoke_test/smoke_test.py @@ -76,6 +76,7 @@ def test_cuda_runtime_errors_captured() -> None: except RuntimeError as e: if re.search("CUDA", f"{e}"): print(f"Caught CUDA exception with success: {e}") + cuda_exception_missed = False else: raise e if(cuda_exception_missed): From a955be163d20f3153143e31319ef2599a6a6c9b7 Mon Sep 17 00:00:00 2001 From: atalman <atalman@fb.com> Date: Mon, 6 Mar 2023 16:44:45 -0800 Subject: [PATCH 10/21] Turn off cuda runtime issue --- test/smoke_test/smoke_test.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/smoke_test/smoke_test.py b/test/smoke_test/smoke_test.py index 1ddda1886..560842373 100644 --- a/test/smoke_test/smoke_test.py +++ b/test/smoke_test/smoke_test.py @@ -115,8 +115,8 @@ def smoke_test_cuda(package: str) -> None: # This check has to be run last, since its messing up CUDA runtime. # Restrict only to conda builds since Wheel seems to crash with # segmentation fault and don't recover - if(package_type == 'conda'): - test_cuda_runtime_errors_captured() + #if(package_type == 'conda'): + # test_cuda_runtime_errors_captured() def smoke_test_conv2d() -> None: From d8080c9a11c6364562399f6f4e925089325d19ae Mon Sep 17 00:00:00 2001 From: atalman <atalman@fb.com> Date: Mon, 6 Mar 2023 17:18:40 -0800 Subject: [PATCH 11/21] tests --- test/smoke_test/smoke_test.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/smoke_test/smoke_test.py b/test/smoke_test/smoke_test.py index 560842373..7d105de57 100644 --- a/test/smoke_test/smoke_test.py +++ b/test/smoke_test/smoke_test.py @@ -207,9 +207,9 @@ def main() -> None: ) options = parser.parse_args() print(f"torch: {torch.__version__}") - check_version(options.package) - smoke_test_conv2d() - smoke_test_linalg() + # check_version(options.package) + # smoke_test_conv2d() + # smoke_test_linalg() if options.package == "all": smoke_test_modules() From d5484aa8c69743bf1c77d2a3b5b88aeab64c6360 Mon Sep 17 00:00:00 2001 From: atalman <atalman@fb.com> Date: Mon, 6 Mar 2023 17:33:33 -0800 Subject: [PATCH 12/21] more tests --- test/smoke_test/smoke_test.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/smoke_test/smoke_test.py b/test/smoke_test/smoke_test.py index 7d105de57..54bb8b761 100644 --- a/test/smoke_test/smoke_test.py +++ b/test/smoke_test/smoke_test.py @@ -211,8 +211,8 @@ def main() -> None: # smoke_test_conv2d() # smoke_test_linalg() - if options.package == "all": - smoke_test_modules() + #if options.package == "all": + # smoke_test_modules() smoke_test_cuda(options.package) From 6d7893ce4dfc0392db876ba686f357ad7178260d Mon Sep 17 00:00:00 2001 From: atalman <atalman@fb.com> Date: Mon, 6 Mar 2023 17:47:24 -0800 Subject: [PATCH 13/21] test --- test/smoke_test/smoke_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/smoke_test/smoke_test.py b/test/smoke_test/smoke_test.py index 54bb8b761..32f2c1621 100644 --- a/test/smoke_test/smoke_test.py +++ b/test/smoke_test/smoke_test.py @@ -169,7 +169,7 @@ def smoke_test_linalg() -> None: torch.linalg.svd(A) def smoke_test_compile() -> None: - supported_dtypes = [torch.float16, torch.float32, torch.float64] + supported_dtypes = [torch.float16, torch.float32] def foo(x: torch.Tensor) -> torch.Tensor: return torch.sin(x) + torch.cos(x) for dtype in supported_dtypes: From b6d34db6e9be7c7c3f0efcac299c4d44a75a27b7 Mon Sep 17 00:00:00 2001 From: atalman <atalman@fb.com> Date: Mon, 6 Mar 2023 18:01:02 -0800 Subject: [PATCH 14/21] remove compile step --- test/smoke_test/smoke_test.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/smoke_test/smoke_test.py b/test/smoke_test/smoke_test.py index 32f2c1621..8da175980 100644 --- a/test/smoke_test/smoke_test.py +++ b/test/smoke_test/smoke_test.py @@ -109,8 +109,8 @@ def smoke_test_cuda(package: str) -> None: print(f"cuDNN enabled? {torch.backends.cudnn.enabled}") # torch.compile is available only on Linux and python 3.8-3.10 - if (sys.platform == "linux" or sys.platform == "linux2") and sys.version_info < (3, 11, 0): - smoke_test_compile() + #if (sys.platform == "linux" or sys.platform == "linux2") and sys.version_info < (3, 11, 0): + # smoke_test_compile() # This check has to be run last, since its messing up CUDA runtime. # Restrict only to conda builds since Wheel seems to crash with From 7cc5b3fbceb12942b332430c723e0936ab7f97fa Mon Sep 17 00:00:00 2001 From: atalman <atalman@fb.com> Date: Mon, 6 Mar 2023 18:14:11 -0800 Subject: [PATCH 15/21] test --- test/smoke_test/smoke_test.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/smoke_test/smoke_test.py b/test/smoke_test/smoke_test.py index 8da175980..facb30ef6 100644 --- a/test/smoke_test/smoke_test.py +++ b/test/smoke_test/smoke_test.py @@ -109,8 +109,8 @@ def smoke_test_cuda(package: str) -> None: print(f"cuDNN enabled? {torch.backends.cudnn.enabled}") # torch.compile is available only on Linux and python 3.8-3.10 - #if (sys.platform == "linux" or sys.platform == "linux2") and sys.version_info < (3, 11, 0): - # smoke_test_compile() + if (sys.platform == "linux" or sys.platform == "linux2") and sys.version_info < (3, 11, 0): + smoke_test_compile() # This check has to be run last, since its messing up CUDA runtime. # Restrict only to conda builds since Wheel seems to crash with @@ -169,7 +169,7 @@ def smoke_test_linalg() -> None: torch.linalg.svd(A) def smoke_test_compile() -> None: - supported_dtypes = [torch.float16, torch.float32] + supported_dtypes = [torch.float32] def foo(x: torch.Tensor) -> torch.Tensor: return torch.sin(x) + torch.cos(x) for dtype in supported_dtypes: From 2358c71bde0401a2b9ce4140eae5d8396fe5ad7b Mon Sep 17 00:00:00 2001 From: atalman <atalman@fb.com> Date: Tue, 7 Mar 2023 04:42:01 -0800 Subject: [PATCH 16/21] disable some of the tests --- .github/scripts/validate_binaries.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/scripts/validate_binaries.sh b/.github/scripts/validate_binaries.sh index cfe7c4486..8ccd45258 100755 --- a/.github/scripts/validate_binaries.sh +++ b/.github/scripts/validate_binaries.sh @@ -34,11 +34,11 @@ else INSTALLATION=${MATRIX_INSTALLATION/"conda install"/"conda install -y"} eval $INSTALLATION - if [[ ${TARGET_OS} == 'linux' ]]; then - export CONDA_LIBRARY_PATH="$(dirname $(which python))/../lib" - export LD_LIBRARY_PATH=$CONDA_LIBRARY_PATH:$LD_LIBRARY_PATH - ${PWD}/check_binary.sh - fi + # if [[ ${TARGET_OS} == 'linux' ]]; then + # export CONDA_LIBRARY_PATH="$(dirname $(which python))/../lib" + # export LD_LIBRARY_PATH=$CONDA_LIBRARY_PATH:$LD_LIBRARY_PATH + # ${PWD}/check_binary.sh + # fi python ./test/smoke_test/smoke_test.py conda deactivate From baca9210d88ea0ff2e164ce4fb8a0b88ab16b837 Mon Sep 17 00:00:00 2001 From: atalman <atalman@fb.com> Date: Tue, 7 Mar 2023 05:04:39 -0800 Subject: [PATCH 17/21] testing --- .github/scripts/validate_binaries.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/scripts/validate_binaries.sh b/.github/scripts/validate_binaries.sh index 8ccd45258..8d082e501 100755 --- a/.github/scripts/validate_binaries.sh +++ b/.github/scripts/validate_binaries.sh @@ -40,7 +40,7 @@ else # ${PWD}/check_binary.sh # fi - python ./test/smoke_test/smoke_test.py + python ./test/smoke_test/smoke_test.py --package torchonly conda deactivate conda env remove -n ${ENV_NAME} fi From ba0659d3c2abc7a1f6c635e048ec799408cd0eee Mon Sep 17 00:00:00 2001 From: atalman <atalman@fb.com> Date: Tue, 7 Mar 2023 05:40:10 -0800 Subject: [PATCH 18/21] Remove extra index url --- .github/scripts/validate_binaries.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/scripts/validate_binaries.sh b/.github/scripts/validate_binaries.sh index 8d082e501..556d8adaf 100755 --- a/.github/scripts/validate_binaries.sh +++ b/.github/scripts/validate_binaries.sh @@ -32,6 +32,7 @@ else conda create -y -n ${ENV_NAME} python=${MATRIX_PYTHON_VERSION} numpy pillow conda activate ${ENV_NAME} INSTALLATION=${MATRIX_INSTALLATION/"conda install"/"conda install -y"} + INSTALLATION=${INSTALLATION/"extra-index-url"/"index-url"} eval $INSTALLATION # if [[ ${TARGET_OS} == 'linux' ]]; then @@ -40,7 +41,7 @@ else # ${PWD}/check_binary.sh # fi - python ./test/smoke_test/smoke_test.py --package torchonly + python ./test/smoke_test/smoke_test.py conda deactivate conda env remove -n ${ENV_NAME} fi From 076ad7873344f0f9bf2c9fc673f67679e958f43e Mon Sep 17 00:00:00 2001 From: atalman <atalman@fb.com> Date: Tue, 7 Mar 2023 05:56:03 -0800 Subject: [PATCH 19/21] test --- .github/scripts/validate_binaries.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/scripts/validate_binaries.sh b/.github/scripts/validate_binaries.sh index 556d8adaf..cce83e4cd 100755 --- a/.github/scripts/validate_binaries.sh +++ b/.github/scripts/validate_binaries.sh @@ -29,7 +29,7 @@ else conda env remove -p ${ENV_NAME}_pypi fi - conda create -y -n ${ENV_NAME} python=${MATRIX_PYTHON_VERSION} numpy pillow + conda create -y -n ${ENV_NAME} python=${MATRIX_PYTHON_VERSION} numpy conda activate ${ENV_NAME} INSTALLATION=${MATRIX_INSTALLATION/"conda install"/"conda install -y"} INSTALLATION=${INSTALLATION/"extra-index-url"/"index-url"} From a86e0bca3aabc43353c717cbce76c7e2d97a36a4 Mon Sep 17 00:00:00 2001 From: atalman <atalman@fb.com> Date: Tue, 7 Mar 2023 13:53:36 -0800 Subject: [PATCH 20/21] Fix tests --- .github/scripts/validate_binaries.sh | 19 +++++++++++-------- test/smoke_test/smoke_test.py | 14 +++++++------- 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/.github/scripts/validate_binaries.sh b/.github/scripts/validate_binaries.sh index cce83e4cd..357b91621 100755 --- a/.github/scripts/validate_binaries.sh +++ b/.github/scripts/validate_binaries.sh @@ -17,9 +17,11 @@ else conda env remove -n ${ENV_NAME} else + + # Special case Pypi installation package, only applicable to linux nightly CUDA 11.7 builds, wheel package - if [[ ${TARGET_OS} == 'linux' && ${MATRIX_CHANNEL} == 'nightly' && ${MATRIX_GPU_ARCH_VERSION} == '11.7' && ${MATRIX_PACKAGE_TYPE} == 'manywheel' ]]; then - conda create -yp ${ENV_NAME}_pypi python=${MATRIX_PYTHON_VERSION} numpy + if [[ ${TARGET_OS} == 'linux' && ${MATRIX_GPU_ARCH_VERSION} == '11.7' && ${MATRIX_PACKAGE_TYPE} == 'manywheel' ]]; then + conda create -yp ${ENV_NAME}_pypi python=${MATRIX_PYTHON_VERSION} numpy ffmpeg INSTALLATION_PYPI=${MATRIX_INSTALLATION/"cu117"/"cu117_pypi_cudnn"} INSTALLATION_PYPI=${INSTALLATION_PYPI/"torchvision torchaudio"/""} INSTALLATION_PYPI=${INSTALLATION_PYPI/"index-url"/"extra-index-url"} @@ -29,17 +31,18 @@ else conda env remove -p ${ENV_NAME}_pypi fi - conda create -y -n ${ENV_NAME} python=${MATRIX_PYTHON_VERSION} numpy + # Please note ffmpeg is required for torchaudio, see https://github.com/pytorch/pytorch/issues/96159 + conda create -y -n ${ENV_NAME} python=${MATRIX_PYTHON_VERSION} numpy ffmpeg conda activate ${ENV_NAME} INSTALLATION=${MATRIX_INSTALLATION/"conda install"/"conda install -y"} INSTALLATION=${INSTALLATION/"extra-index-url"/"index-url"} eval $INSTALLATION - # if [[ ${TARGET_OS} == 'linux' ]]; then - # export CONDA_LIBRARY_PATH="$(dirname $(which python))/../lib" - # export LD_LIBRARY_PATH=$CONDA_LIBRARY_PATH:$LD_LIBRARY_PATH - # ${PWD}/check_binary.sh - # fi + if [[ ${TARGET_OS} == 'linux' ]]; then + export CONDA_LIBRARY_PATH="$(dirname $(which python))/../lib" + export LD_LIBRARY_PATH=$CONDA_LIBRARY_PATH:$LD_LIBRARY_PATH + ${PWD}/check_binary.sh + fi python ./test/smoke_test/smoke_test.py conda deactivate diff --git a/test/smoke_test/smoke_test.py b/test/smoke_test/smoke_test.py index facb30ef6..8ee98dfe3 100644 --- a/test/smoke_test/smoke_test.py +++ b/test/smoke_test/smoke_test.py @@ -115,8 +115,8 @@ def smoke_test_cuda(package: str) -> None: # This check has to be run last, since its messing up CUDA runtime. # Restrict only to conda builds since Wheel seems to crash with # segmentation fault and don't recover - #if(package_type == 'conda'): - # test_cuda_runtime_errors_captured() + if(package_type == 'conda'): + test_cuda_runtime_errors_captured() def smoke_test_conv2d() -> None: @@ -207,12 +207,12 @@ def main() -> None: ) options = parser.parse_args() print(f"torch: {torch.__version__}") - # check_version(options.package) - # smoke_test_conv2d() - # smoke_test_linalg() + check_version(options.package) + smoke_test_conv2d() + smoke_test_linalg() - #if options.package == "all": - # smoke_test_modules() + if options.package == "all": + smoke_test_modules() smoke_test_cuda(options.package) From 20b4b4f046054135617f7aa2b3987419698f109d Mon Sep 17 00:00:00 2001 From: atalman <atalman@fb.com> Date: Tue, 7 Mar 2023 14:08:26 -0800 Subject: [PATCH 21/21] Additional smoke tests Remove release blocking changes --- .github/workflows/validate-nightly-binaries.yml | 4 ++-- test/smoke_test/smoke_test.py | 8 ++------ 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/.github/workflows/validate-nightly-binaries.yml b/.github/workflows/validate-nightly-binaries.yml index 3ae05cc32..c252e0433 100644 --- a/.github/workflows/validate-nightly-binaries.yml +++ b/.github/workflows/validate-nightly-binaries.yml @@ -30,6 +30,6 @@ jobs: nightly: uses: ./.github/workflows/validate-binaries.yml with: - channel: test + channel: nightly os: all - limit-win-builds: disable + limit-win-builds: enable diff --git a/test/smoke_test/smoke_test.py b/test/smoke_test/smoke_test.py index 8ee98dfe3..4e9eaaf31 100644 --- a/test/smoke_test/smoke_test.py +++ b/test/smoke_test/smoke_test.py @@ -112,11 +112,7 @@ 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() - # This check has to be run last, since its messing up CUDA runtime. - # Restrict only to conda builds since Wheel seems to crash with - # segmentation fault and don't recover - if(package_type == 'conda'): - test_cuda_runtime_errors_captured() + test_cuda_runtime_errors_captured() def smoke_test_conv2d() -> None: @@ -169,7 +165,7 @@ def smoke_test_linalg() -> None: torch.linalg.svd(A) def smoke_test_compile() -> None: - supported_dtypes = [torch.float32] + supported_dtypes = [torch.float16, torch.float32, torch.float64] def foo(x: torch.Tensor) -> torch.Tensor: return torch.sin(x) + torch.cos(x) for dtype in supported_dtypes: