已合并
Fixed some unit tests. #14100
yuhaiyan8创建于 2024年8月28日
Fixed some unit tests. #14100
已合并
yuhaiyan8创建于 2024年8月28日
refs/pull/14100/head合入到master
4 个文件变更+8-13
Mtest/distributed/_fault_mode_cases/error_hccl_timeout.py+1-0
@@ -8,6 +8,7 @@ def hccl_timeout():
8 os.environ["MASTER_ADDR"] = "127.0.0.1"8 os.environ["MASTER_ADDR"] = "127.0.0.1"
9 os.environ["MASTER_PORT"] = "29500"9 os.environ["MASTER_PORT"] = "29500"
10 os.environ["HCCL_WHITELIST_DISABLE"] = "1"10 os.environ["HCCL_WHITELIST_DISABLE"] = "1"
11+ os.environ["HCCL_EXEC_TIMEOUT"] = "180"
11 backend = "hccl"12 backend = "hccl"
12 dist.init_process_group(backend)13 dist.init_process_group(backend)
13 rank = dist.get_rank()14 rank = dist.get_rank()
Mtest/distributed/_fault_mode_cases/error_use_same_addr.py+1-1
@@ -12,7 +12,7 @@ def same_addr():
12 dist.init_process_group(backend)12 dist.init_process_group(backend)
13 rank = dist.get_rank()13 rank = dist.get_rank()
14 torch.npu.set_device(rank)14 torch.npu.set_device(rank)
15- input_ = torch.tensor(2).npu()15+ input_ = torch.randn(100, 100, 20).npu()
16 dist.all_reduce(input_)16 dist.all_reduce(input_)
17 17 
18 18 
Mtest/distributed/test_fault_mode.py+5-11
@@ -143,17 +143,11 @@ class TestMode(TestCase):
143 process.stdout.close()143 process.stdout.close()
144 process.terminate()144 process.terminate()
145 process.wait()145 process.wait()
146- device_name = torch_npu.npu.get_device_name(0)[:10]146+ self.assertIn(
147- if device_name in ["Ascend910A", "Ascend910P"]:147+ "EI0002",
148- self.assertIn(148+ message
149- "EI0002",149+ )
150- message150+ 
151- )
152- else:
153- self.assertIn(
154- "EI9999",
155- message
156- )
157 151 
158 152 
159if __name__ == "__main__":153if __name__ == "__main__":
Mtest/npu/test_npu.py+1-1
@@ -347,7 +347,7 @@ class TestNpu(TestCase):
347 347 
348 for dst, try_non_blocking in product(("npu", "cpu"), (True, False)):348 for dst, try_non_blocking in product(("npu", "cpu"), (True, False)):
349 # Creates source on the opposite device from destination.349 # Creates source on the opposite device from destination.
350- src = torch.randn(10000, 10000, 2,350+ src = torch.randn(1000, 1000, 2, 100,
351 device="npu" if dst == "cpu" else "cpu",351 device="npu" if dst == "cpu" else "cpu",
352 pin_memory=True if dst == "npu" else False)352 pin_memory=True if dst == "npu" else False)
353 _test_to_non_blocking(src, try_non_blocking, dst)353 _test_to_non_blocking(src, try_non_blocking, dst)