From 4ed50bc4ae27f64a54365301852b83b29e17a79e Mon Sep 17 00:00:00 2001 From: Kai Gao Date: Sat, 7 Sep 2024 09:48:25 +0800 Subject: [PATCH] Avoid unnecessary iterations when updating CPU rank Signed-off-by: Kai Gao --- .../framework/communicator/hccl_comm.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/domain/collective_communication/framework/communicator/hccl_comm.cc b/src/domain/collective_communication/framework/communicator/hccl_comm.cc index 5cca925..336ead7 100644 --- a/src/domain/collective_communication/framework/communicator/hccl_comm.cc +++ b/src/domain/collective_communication/framework/communicator/hccl_comm.cc @@ -72,6 +72,7 @@ void hcclComm::UpdateIsHaveCpuRank(const RankTable_t &rankTable) // 同一server的标识IP 是一样的,所以可以以此推算出平均dev个数 if (rankTable.rankList[i].deviceInfo.devicePhyId == HOST_DEVICE_ID) { isHaveCpuRank_ = true; + return; } } } @@ -82,6 +83,7 @@ void hcclComm::UpdateIsHaveCpuRank(const std::vector &rankList) // 同一server的标识IP 是一样的,所以可以以此推算出平均dev个数 if (rankList[i].devicePhyId == HOST_DEVICE_ID) { isHaveCpuRank_ = true; + return; } } } -- Gitee