From bc514cb42521f3ebd3499473b8f079a4e3164f9b Mon Sep 17 00:00:00 2001 From: Ilya Persky Date: Thu, 6 Jan 2022 08:53:50 -0800 Subject: [PATCH] Skip distributed tests if built with USE_DISTRIBUTED=0 (#70677) Summary: Fixes https://github.com/pytorch/pytorch/issues/70676 Pull Request resolved: https://github.com/pytorch/pytorch/pull/70677 Reviewed By: albanD Differential Revision: D33439808 Pulled By: janeyx99 fbshipit-source-id: 7f9971eb564dbbb6625fe5f78328c3abe3808719 --- test/run_test.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/test/run_test.py b/test/run_test.py index 15fb6c81da1..d8a0ef417f0 100644 --- a/test/run_test.py +++ b/test/run_test.py @@ -940,7 +940,7 @@ def get_selected_tests(options): WINDOWS_BLOCKLIST.append("jit") WINDOWS_BLOCKLIST.append("jit_fuser") - # This is exception thats caused by this issue https://github.com/pytorch/pytorch/issues/69460 + # This is exception that's caused by this issue https://github.com/pytorch/pytorch/issues/69460 # This below code should be removed once this issue is solved if torch.version.cuda is not None and LooseVersion(torch.version.cuda) >= "11.5": WINDOWS_BLOCKLIST.append("test_cpp_extensions_aot") @@ -969,6 +969,11 @@ def get_selected_tests(options): which_shard, num_shards, selected_tests, TEST_TIMES_FILE ) + # skip all distributed tests if distributed package is not available. + if not dist.is_available(): + selected_tests = exclude_tests(DISTRIBUTED_TESTS, selected_tests, + "PyTorch is built without distributed support.") + return selected_tests