LCOV - code coverage report
Current view: top level - legacy/ascend910/framework/inc - topoinfo_struct.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 0.0 % 8 0
Test Date: 2026-08-18 17:47:01 Functions: 0.0 % 2 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 TOPOINFO_STRUCT_H
      12              : #define TOPOINFO_STRUCT_H
      13              : 
      14              : #include <string>
      15              : #include <vector>
      16              : #include <memory>
      17              : #include <mutex>
      18              : #include "hccl/base.h"
      19              : #include "hccl_common.h"
      20              : #include "adapter_pub.h"
      21              : #include "externalinput_pub.h"
      22              : #include "hccl_network_pub.h"
      23              : 
      24              : namespace hccl {
      25              : using NetworkInfo_t = struct tagNetworkInfo {
      26              :     std::string ethName;       // [DEPRECATED]网卡名, 用于获取PCIe总线信息, 网卡在device侧时无效
      27              :     HcclIpAddress ipAddr;      // [DEPRECATED]空字符串则表示没有配ip, 不得参与节点间通信
      28              :     u32 networkPort{0};        // [DEPRECATED]port接口
      29              :     HcclIpAddress refIp;       // [DEPRECATED]reference ip
      30              :     u32 planeID{INVALID_UINT}; // [DEPRECATED]该网卡对应的网络平面ID, 用于控制网卡之间的建链
      31              : };
      32              : 
      33              : // [DEPRECATED] type ServerInfo_t
      34              : using ServerInfo_t = struct tagServerInfo {
      35              :     std::string serverId;                   // 集群内服务器唯一标识
      36              :     std::vector<NetworkInfo_t> networkInfo; // [DEPRECATED]网卡信息
      37            0 :     bool operator==(const tagServerInfo& that) { return this->serverId == that.serverId; }
      38              : };
      39              : 
      40              : using DeviceInfo_t = struct tagDeviceInfo {
      41              :     s32 devicePhyId;                             // 服务器内device唯一标识
      42              :     DevType deviceType{DevType::DEV_TYPE_NOSOC}; // 服务器内device类型
      43              :     std::vector<HcclIpAddress> deviceIp;         // device 对应的网卡ip
      44              :     std::vector<HcclIpAddress> backupDeviceIp;   // 同一卡另一个device的网卡ip,应用于重执行借轨场景
      45              :     HcclIpAddress refIp;                         // [DEPRECATED]device 对应的ref ip
      46              :     u32 port{HCCL_INVALID_PORT};
      47              :     u32 vnicPort{HCCL_INVALID_PORT};
      48              :     u32 backupPort{HCCL_INVALID_PORT};
      49              :     NICDeployment nicDeploy{NICDeployment::NIC_DEPLOYMENT_DEVICE};
      50              :     u32 proto;
      51              : };
      52              : 
      53              : using TransportInfo_t = struct tagTransportInfo {
      54              :     u32 dstRankId;
      55              :     TransportType transportType;
      56              : };
      57              : 
      58              : using RankInfo_t = struct tagRankInfo {
      59              :     u32 rankId = 0xFFFFFFFF;                    // rank 标识,userRank,cloud时hcom计算填入
      60              :     u32 localRank = 0xFFFFFFFF;                 // 本server内rank号
      61              :     std::string serverId;                       // 集群内服务器唯一标识
      62              :     u32 serverIdx = INVALID_UINT;               // Server在ranktable中的自然顺序(用户指定)
      63              :     u32 superDeviceId = INVALID_UINT;           // 超节点device id,超节点内唯一
      64              :     std::string superPodId;                     // 超节点标识
      65              :     u32 superPodIdx = INVALID_UINT;             // SuperPod在ranktable中的自然顺序(用户指定)
      66              :     HcclIpAddress hostIp;                       // 本server的host ip,用于host rdma通信
      67              :     u32 hostPort = HCCL_INVALID_PORT;           // 本rank进行host socket通信使用的端口
      68              :     u32 nodeId = INVALID_UINT;                  // 离线编译逻辑ranktable 和NumaConfig中的node id相同
      69              :     s32 itemId = INVALID_UINT;                  // 离线编译逻辑ranktable 和NumaConfig中的item id相同
      70              :     std::string groupName;                      // [DEPRECATED]group名称
      71              :     std::string podName;                        // [DEPRECATED]容器名称
      72              :     DeviceInfo_t deviceInfo;                    // 设备信息
      73              :     std::vector<TransportInfo_t> transportInfo; // [DEPRECATED]本rank与其余rank的数据传输信息(抽象信息)
      74              :     s32 bindDeviceId = INVALID_INT;             // 绑定的device id
      75              :     TlsStatus tlsStatus = TlsStatus::UNKNOWN;   // TLS开关状态
      76              :     std::string originalSuperPodId;             // 划分逻辑超节点前的原超节点ID,来源为用户配置
      77              : };
      78              : 
      79              : // 对外的ranktable格式
      80              : using RankTable_t = struct tagRankTable {
      81              :     u32 deviceNum{0};                                              // 当前通信域内device数量
      82              :     u32 serverNum{0};                                              // 集群内服务器总数
      83              :     u32 superPodNum{0};                                            // 集群超节点总数
      84              :     u32 groupNum{0};                                               // [DEPRECATED]集群内group总数
      85              :     NICDeployment nicDeploy{NICDeployment::NIC_DEPLOYMENT_DEVICE}; // 网卡挂载位置 0:host 1:device
      86              :     u32 nicNum{0};                                                 // [DEPRECATED]参数平面网卡数量
      87              :     std::vector<std::string> nicNames;                             // [DEPRECATED]参数平面网卡名称
      88              :     u32 rankNum{0};                                                // 通信域内的rank总数
      89              :     std::vector<RankInfo_t> rankList;                              // 通信域内所有的rank信息
      90              :     std::vector<ServerInfo_t> serverList; // [DEPRECATED]通信域内服务器信息 目前cloud和lab网卡在device场景置空
      91              :     std::string collectiveId;             // 通信域ID
      92              :     std::string version;                  // rankTable版本信息
      93              :     std::string mode;                     // [DEPRECATED]通讯方式tcp/rdma
      94              : };
      95              : 
      96              : using RoleTableNodeInfo = struct RoleTableNodeInfoTag {
      97              :     u32 id;
      98              :     std::string serverId;
      99              :     HcclIpAddress ipAddr;
     100              :     u32 port;
     101              :     u32 rankId;
     102              :     HcclIpAddress hostIp;
     103              :     u32 hostPort{HCCL_INVALID_PORT};
     104              :     s32 devicePhyId;
     105            0 :     RoleTableNodeInfoTag()
     106            0 :         : id(INVALID_UINT),
     107            0 :           port(INVALID_UINT),
     108            0 :           rankId(INVALID_UINT),
     109            0 :           hostPort(INVALID_UINT),
     110            0 :           devicePhyId(INVALID_INT)
     111            0 :     {}
     112              : };
     113              : 
     114              : using RoleTableInfo = struct RoleTableInfoTag {
     115              :     std::vector<RoleTableNodeInfo> servers;
     116              :     std::vector<RoleTableNodeInfo> clients;
     117              : };
     118              : 
     119              : constexpr uint32_t ROOTINFO_INDENTIFIER_MAX_LENGTH = 128;
     120              : constexpr uint32_t ROOTINFO_PORT_MAX_LENGTH = 16;
     121              : using HcclRootHandle = struct HcclRootHandleDef {
     122              :     char ip[IP_ADDRESS_BUFFER_LEN];
     123              :     uint32_t port;
     124              :     NICDeployment nicDeploy;
     125              :     char identifier[ROOTINFO_INDENTIFIER_MAX_LENGTH];
     126              :     u32 rankId;
     127              : };
     128              : 
     129              : using HcclRankHandle = HcclRootHandle;
     130              : 
     131              : using GroupLeader_t = struct tagGroupLeaderInfo {
     132              :     u32 grpLeaderNum{0};
     133              :     std::vector<HcclRankHandle> GroupLeaderList;
     134              : };
     135              : 
     136              : const std::string PROP_STEP = "step";
     137              : const std::string PROP_RANK_NUM = "rank_num";
     138              : const std::string PROP_DEV_NUM = "device_num";
     139              : const std::string PROP_SRV_NUM = "server_num";
     140              : const std::string PROP_DEV_INFO = "dev_info";
     141              : const std::string PROP_RANK_LIST = "rank_list";
     142              : const std::string PROP_RANK_ID = "rank_id";
     143              : const std::string PROP_DEST_RANK = "dest_rank";
     144              : const std::string PROP_SERVER_ID = "server_id";
     145              : const std::string PROP_SERVER_LIST = "server_list";
     146              : const std::string PROP_DEV_ID = "device_id";
     147              : const std::string PROP_DEV_TYPE = "device_type";
     148              : const std::string PROP_DEV_IP = "device_ip";
     149              : const std::string PROP_DEV_NIC_PORT = "device_port";
     150              : const std::string PROP_DEV_VNIC_PORT = "device_vnic_port";
     151              : const std::string PROP_BACKUP_DEV_PORT = "backup_device_port";
     152              : const std::string PROP_BACKUP_DEV_IP = "backup_device_ip";
     153              : const std::string PROP_HOST_IP = "host_ip";
     154              : const std::string PROP_DEPLOY_MODE = "deploy_mode";
     155              : const std::string PROP_TRANS_INFO = "trans_info";
     156              : const std::string PROP_TRANS_TYPE = "trans_type";
     157              : const std::string PROP_TLS_STATUS = "tls_status";
     158              : 
     159              : const std::string PROP_SERVER_COUNT = "server_count";
     160              : const std::string PROP_DEVICE = "device";
     161              : const std::string PROP_STATUS = "status";
     162              : const std::string PROP_VERSION = "version";
     163              : 
     164              : const std::string PROP_SUPER_POD_LIST = "super_pod_list";
     165              : const std::string PROP_SUPER_POD_ID = "super_pod_id";
     166              : const std::string PROP_SUPER_DEVICE_ID = "super_device_id";
     167              : const std::string PROP_SUPER_POD_NUM = "super_pod_num";
     168              : 
     169              : const std::string PROP_NETWORK_INFO_LIST = "network_info_list";
     170              : const std::string PROP_NETWORK_ETHNAME = "eth_name";
     171              : const std::string PROP_NETWORK_IPADDR = "ip_addr";
     172              : const std::string PROP_NETWORK_NETWORKPORT = "network_port";
     173              : const std::string PROP_NETWORK_REFIP = "ref_ip";
     174              : const std::string PROP_NETWORK_PLANEID = "plane_id";
     175              : 
     176              : const std::string PROP_NETWORK_IDENTIFIER = "identifier";
     177              : const std::string PROP_GROUP_LEADER_LIST = "group_leader_list";
     178              : const std::string PROP_GROUP_CLUSTER_LIST = "group_cluster_list";
     179              : 
     180              : const std::string TOPO_DETECT_TAG = "topo_detect_default_tag";
     181              : } // namespace hccl
     182              : #endif /* __TOPINFO_STRUCT_H__ */
        

Generated by: LCOV version 2.0-1