From 78a8b36dd44c0041c539a8eb538c945728f04e09 Mon Sep 17 00:00:00 2001 From: sunboquan Date: Wed, 21 Feb 2024 16:55:32 +0800 Subject: [PATCH] ut bugfix --- .../cluster_advice/slow_link_advice.py | 8 ++++---- .../cluster_advice/test_slow_link_advice.py | 20 +++++++++---------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/profiler/advisor/advisor_backend/cluster_advice/slow_link_advice.py b/profiler/advisor/advisor_backend/cluster_advice/slow_link_advice.py index 62050a87c1..e350e08f39 100644 --- a/profiler/advisor/advisor_backend/cluster_advice/slow_link_advice.py +++ b/profiler/advisor/advisor_backend/cluster_advice/slow_link_advice.py @@ -82,11 +82,11 @@ class SlowLinkAdvice(ClusterAdviceBase): raise ValueError(msg) from e for comm_type, bw_dict in rank_dict.get(self.COMMUNICATION_BANDWIDTH_INFO, {}).items(): if comm_type == self.SDMA: - self.rank_bw_dict[rank][self.SDMA_SIZE_MB] += bw_dict.get(self.TRANSIT_TIME) - self.rank_bw_dict[rank][self.SDMA_TIME_MS] += bw_dict.get(self.TRANSIT_SIZE) + self.rank_bw_dict[rank][self.SDMA_SIZE_MB] += bw_dict.get(self.TRANSIT_SIZE) + self.rank_bw_dict[rank][self.SDMA_TIME_MS] += bw_dict.get(self.TRANSIT_TIME) if comm_type == self.RDMA: - self.rank_bw_dict[rank][self.RDMA_SIZE_MB] += bw_dict.get(self.TRANSIT_TIME) - self.rank_bw_dict[rank][self.RDMA_TIME_MS] += bw_dict.get(self.TRANSIT_SIZE) + self.rank_bw_dict[rank][self.RDMA_SIZE_MB] += bw_dict.get(self.TRANSIT_SIZE) + self.rank_bw_dict[rank][self.RDMA_TIME_MS] += bw_dict.get(self.TRANSIT_TIME) for rank, rank_dict in self.rank_bw_dict.items(): self.rank_bw_dict[rank][self.RDMA_BANDWIDTH] = self.compute_ratio( diff --git a/profiler/test/ut/advisor/advisor_backend/cluster_advice/test_slow_link_advice.py b/profiler/test/ut/advisor/advisor_backend/cluster_advice/test_slow_link_advice.py index 79307813f5..bf283cda5c 100644 --- a/profiler/test/ut/advisor/advisor_backend/cluster_advice/test_slow_link_advice.py +++ b/profiler/test/ut/advisor/advisor_backend/cluster_advice/test_slow_link_advice.py @@ -17,25 +17,25 @@ class TestSlowLinkAdvice(unittest.TestCase): 0: { 'RDMA time(ms)': 0, 'RDMA size(mb)': 0, - 'SDMA time(ms)': 0.08536799999999997, - 'SDMA size(mb)': 0.03629965625, + 'SDMA time(ms)': 0.03629965625, + 'SDMA size(mb)': 0.08536799999999997, 'RDMA bandwidth(GB/s)': 0, - 'SDMA bandwidth(GB/s)': 0.4252 + 'SDMA bandwidth(GB/s)': 2.3518 }, 1: { 'RDMA time(ms)': 0, 'RDMA size(mb)': 0, - 'SDMA time(ms)': 0.13439200000000004, - 'SDMA size(mb)': 0.05697939062500001, + 'SDMA time(ms)': 0.05697939062500001, + 'SDMA size(mb)': 0.13439200000000004, 'RDMA bandwidth(GB/s)': 0, - 'SDMA bandwidth(GB/s)': 0.424 + 'SDMA bandwidth(GB/s)': 2.3586 } } cls.expect_bottleneck = 'SDMA bandwidth(GB/s): \n' \ - 'The average is 0.425, ' \ - 'while the maximum is 0.425GB/s and ' \ - 'the minimum is 0.424GB/s. ' \ - 'the difference is 0.001GB/s. \n' + 'The average is 2.355, ' \ + 'while the maximum is 2.359GB/s and ' \ + 'the minimum is 2.352GB/s. ' \ + 'the difference is 0.007GB/s. \n' def test_compute_ratio_abnormal(self): result = SlowLinkAdvice.compute_ratio(19.0, 0) -- Gitee