LCOV - code coverage report
Current view: top level - legacy/ascend910/algorithm/base/communicator - calc_transport_req_base.cc (source / functions) Coverage Total Hit
Test: coverage.info Lines: 58.3 % 24 14
Test Date: 2026-08-17 10:19:35 Functions: 50.0 % 6 3

            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              : #include "calc_transport_req_base.h"
      12              : 
      13              : namespace hccl {
      14          169 : CalcTransportReqBase::CalcTransportReqBase(
      15          169 :     const std::vector<std::vector<u32>>& subCommPlaneVector, const std::vector<bool>& isBridgeVector, u32 userRank)
      16          169 :     : subCommPlaneVector_(subCommPlaneVector),
      17          169 :       isBridgeVector_(isBridgeVector),
      18          169 :       userRank_(userRank)
      19          169 : {}
      20              : 
      21          169 : CalcTransportReqBase::~CalcTransportReqBase() {}
      22              : 
      23            0 : HcclResult CalcTransportReqBase::CalcTransportRequest(
      24              :     const std::string& tag, TransportMemType inputMemType, TransportMemType outputMemType,
      25              :     const CommParaInfo& commParaInfo, std::vector<SingleSubCommTransport>& commTransport, u32 subUserRankRoot)
      26              : {
      27            0 :     return HCCL_SUCCESS;
      28              : }
      29              : 
      30          205 : u32 CalcTransportReqBase::GetSubCollectiveRank(const std::vector<u32>& vecPara) const
      31              : {
      32              :     // 在vecPara数据中,查询本user rank,查询到的vec下标就是rank值
      33          205 :     u32 tmpRank = INVALID_VALUE_RANKID;
      34              : 
      35          322 :     for (u32 rankIndex = 0; rankIndex < vecPara.size(); rankIndex++) {
      36          320 :         if (userRank_ == vecPara[rankIndex]) {
      37          204 :             tmpRank = rankIndex;
      38          204 :             break;
      39              :         }
      40              :     }
      41              : 
      42          204 :     return tmpRank;
      43              : }
      44              : 
      45            0 : HcclResult CalcTransportReqBase::GetRankByUserRank(const std::vector<u32>& vecPara, const u32 userRank, u32& rank) const
      46              : {
      47              :     // 在vecPara数据中,查询指定userRank,查询到的vec下标就是rank值
      48            0 :     rank = INVALID_VALUE_RANKID;
      49              : 
      50            0 :     for (u32 rankIndex = 0; rankIndex < vecPara.size(); rankIndex++) {
      51            0 :         if (userRank == vecPara[rankIndex]) {
      52            0 :             rank = rankIndex;
      53            0 :             break;
      54              :         }
      55              :     }
      56            0 :     HCCL_INFO("[Get][RankByUserRank]userRank[%u] --> rank[%u]", userRank, rank);
      57            0 :     return HCCL_SUCCESS;
      58              : }
      59              : 
      60              : } // namespace hccl
        

Generated by: LCOV version 2.0-1