LCOV - code coverage report
Current view: top level - coll_communicator_mgr/rank_graph/rank_table_info - rank_table_info.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 1 1
Test Date: 2026-07-28 12:11:00 Functions: 100.0 % 1 1

            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 NEW_RANK_TABLED_H
      12              : #define NEW_RANK_TABLED_H
      13              : 
      14              : #include <vector>
      15              : #include <string>
      16              : #include <unordered_map>
      17              : #include <climits>
      18              : #include "nlohmann/json.hpp"
      19              : #include "new_rank_info.h"
      20              : #include "port.h"
      21              : 
      22              : namespace Hccl {
      23              : constexpr unsigned int MAX_RANKCOUNT = 65536;
      24              : constexpr u32 UNDEFIEND_LOCAL_ID = UINT_MAX;
      25              : class RankTableInfo{
      26              : public:
      27           96 :     RankTableInfo(){};
      28              :     RankTableInfo(BinaryStream& binaryStream);
      29              :     std::string                version;
      30              :     u32                        rankCount{0};
      31              :     std::vector<NewRankInfo>   ranks;
      32              :     bool                       detour=false;
      33              :     std::string                Describe() const;
      34              :     void                       Dump() const;
      35              :     void                       Deserialize(const nlohmann::json &rankTableInfoJson, bool isCheck = true);
      36              :     vector<char>               GetUniqueId(bool isContainLocId) const;  // 获取rankTable的字节流,供一致性校验crc时带localId使用
      37              :     void                       GetBinStream(bool isContainLocId, BinaryStream& binaryStream) const;
      38              :     void                       Check();
      39              :     void                       UpdateRankTable(const RankTableInfo &localRankInfo);
      40              :     std::unordered_map<u32, std::unordered_map<IpAddress, u32>> GetRankDeviceListenPortMap();
      41              : 
      42              : private:
      43              :     void CheckAndInsert(const std::string& levelId, u32 rankAddrSize,
      44              :                         std::unordered_map<std::string, u32>& idRankSizeMap) const;
      45              :     void InsertToRank(const std::string& levelId, u32 rankAddrSize,
      46              :                         std::vector<std::unordered_map<std::string, u32>>& rankLists, u32 levelNum) const;
      47              : };
      48              : 
      49              : } // namespace Hccl
      50              : 
      51              : #endif // NEW_RANK_TABLED_H
        

Generated by: LCOV version 2.0-1