LCOV - code coverage report
Current view: top level - legacy/ascend950/service/collective/alg/coll_alg_factory/alg_topo_match - topo_match_concurr_mesh_nhr.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 0.0 % 3 0
Test Date: 2026-08-04 10:52:23 Functions: 0.0 % 1 0

            Line data    Source code
       1              : /**
       2              :  * Copyright (c) 2025 Huawei Technologies Co., Ltd.
       3              :  * This program is free software, you can redistribute it and/or modify it under the terms and conditions of
       4              :  * CANN Open Software License Agreement Version 2.0 (the "License").
       5              :  * Please refer to the License for details. You may not use this file except in compliance with the License.
       6              :  * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
       7              :  * INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
       8              :  * See LICENSE in the root of the software repository for the full text of the License.
       9              :  */
      10              : 
      11              : #ifndef HCCLV2_TOPO_MATCH_CONCURR_MESH_NHR
      12              : #define HCCLV2_TOPO_MATCH_CONCURR_MESH_NHR
      13              : 
      14              : #include "topo_match_base.h"
      15              : 
      16              : namespace Hccl {
      17              : 
      18              : class TopoMatchConcurrMeshNHR : public TopoMatchBase {
      19              : public:
      20              :     explicit TopoMatchConcurrMeshNHR(const RankId vRank, const u32 rankSize, const RankGraph *rankGraph,
      21              :                                   const DevType devType);
      22              :     ~TopoMatchConcurrMeshNHR() override;
      23              : 
      24            0 :     std::string Describe() const override
      25              :     {
      26            0 :         return "Topo Match for Multi-dimensional Concurrent Mesh Algorithm (CURRENTLY only 2-D Concurr Mesh is "
      27            0 :                "supported).";
      28              :     }
      29              :     using TopoMatchBase::MatchTopo;
      30              :     HcclResult MatchTopo(std::vector<std::vector<std::vector<RankId>>> &vTopo,
      31              :         std::vector<std::vector<RankId>> &virtRanks, std::vector<std::map<RankId, u32>> &virtRankMap) override;
      32              : 
      33              : private:
      34              :     std::vector<RankId> rankOnSameBoard_; // ranks with same boardIds in rack
      35              :     std::vector<RankId> rankOnSameSlot_;  // ranks with same slotIds in rack
      36              :     std::vector<std::vector<RankId>> rankOnSameBoardVector_;  // ranks vector with same boardIds in rack
      37              :     std::vector<std::vector<RankId>> rankOnSameSlotVector_;  // ranks vector with same slotIds in rack
      38              :     std::vector<u32> numRanksPerBoard_;  // ranks num with same boardIds in rack
      39              : 
      40              :     HcclResult GenerateLevel0(const std::set<RankId> &rankSetLevel0, u32 gcdInstSize, RankId rankId, 
      41              :                               std::vector<std::vector<std::vector<RankId>>> &vTopo,
      42              :                               std::vector<std::vector<RankId>> &virtRanks);
      43              : 
      44              :     // 当 level0 子通信域为矩形时, 计算 myRank 所在 level0 子通信域的具体信息
      45              :     HcclResult FindLevel0Block(const Matrix<RankId>& podTopo, u32 subDim0Size, u32 subDim1Size,
      46              :                                u32 myRank, std::vector<RankId>& subRankList, Matrix<RankId>& subRankTopo) const;
      47              : 
      48              :     // FindLevel0Bloc 的辅助函数
      49              :     HcclResult FindMyRankLocation(const Matrix<RankId>& podTopo, u32 myRank, u32 &row, u32 &col) const;
      50              :     HcclResult ExtractLevel0Block(const Matrix<RankId>& podTopo, u32 startRow, u32 startCol,
      51              :                                   u32 targetRow, u32 targetCol,
      52              :                                   u32 subDim0Size, u32 subDim1Size,
      53              :                                   std::vector<RankId>& subRankList,
      54              :                                   Matrix<RankId>& subRankTopo) const;
      55              : 
      56              :     // 对称判断依据: instSizeList 中每个元素相等
      57              :     bool CheckSymmetric(std::vector<u32>& values) const;
      58              : };
      59              : } // namespace Hccl
      60              : 
      61              : #endif // !HCCLV2_TOPO_MATCH_CONCURR_MESH_NHR
        

Generated by: LCOV version 2.0-1