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 "topoinfo_ranktableConcise.h"
12 : #include <map>
13 : #include <vector>
14 : #include <string>
15 : #include <fstream>
16 : #include <algorithm>
17 : #include <unistd.h>
18 : #include <chrono>
19 : #include <iostream>
20 : #include <arpa/inet.h>
21 :
22 : #include "log.h"
23 : #include "env_config.h"
24 : #include "hccl_comm_pub.h"
25 : // ltm指定config路径
26 : #include "common/src/config.h"
27 : #include "workflow_pub.h"
28 : #include "device_capacity.h"
29 :
30 : using namespace std;
31 : using namespace hccl;
32 :
33 1 : TopoinfoRanktableConcise::TopoinfoRanktableConcise(const std::string& rankTableM, const std::string& identify)
34 : : TopoInfoRanktableParser(rankTableM, identify),
35 1 : isInterSuperPodRetryEnable_(GetExternalInputInterSuperPodRetryEnable())
36 1 : {}
37 :
38 1 : TopoinfoRanktableConcise::~TopoinfoRanktableConcise() {}
39 :
40 0 : HcclResult TopoinfoRanktableConcise::Init() { return HCCL_E_NOT_SUPPORT; }
41 :
42 0 : HcclResult TopoinfoRanktableConcise::GetClusterInfo([[maybe_unused]] RankTable_t& clusterInfo)
43 : {
44 0 : return HCCL_E_NOT_SUPPORT;
45 : }
46 :
47 0 : HcclResult TopoinfoRanktableConcise::GetSelfClusterInfo([[maybe_unused]] HcclCommParams& params)
48 : {
49 0 : return HCCL_E_NOT_SUPPORT;
50 : }
51 :
52 0 : HcclResult TopoinfoRanktableConcise::GetClusterInfo(
53 : [[maybe_unused]] hccl::HcclCommParams& params, [[maybe_unused]] hccl::RankTable_t& rankTable)
54 : {
55 0 : return HCCL_E_NOT_SUPPORT;
56 : }
57 :
58 0 : HcclResult TopoinfoRanktableConcise::SetIsInterSuperPodRetryEnable([[maybe_unused]] bool isRetryEnable)
59 : {
60 0 : return HCCL_E_NOT_SUPPORT;
61 : }
62 :
63 0 : void TopoinfoRanktableConcise::DetectNicDepoly([[maybe_unused]] RankTable_t& rankTable) { return; }
64 :
65 0 : HcclResult TopoinfoRanktableConcise::ParserClusterInfo(
66 : [[maybe_unused]] hccl::HcclCommParams& params, [[maybe_unused]] hccl::RankTable_t& rankTable)
67 : {
68 0 : return HCCL_E_NOT_SUPPORT;
69 : }
70 :
71 0 : HcclResult TopoinfoRanktableConcise::CheckNicDeployConsistence(
72 : [[maybe_unused]] RankTable_t& clusterInfo, [[maybe_unused]] NICDeployment deploy) const
73 : {
74 0 : return HCCL_E_NOT_SUPPORT;
75 : }
76 :
77 0 : HcclResult TopoinfoRanktableConcise::GetRanktableInfo([[maybe_unused]] RankTable_t& clusterInfo)
78 : {
79 0 : return HCCL_E_NOT_SUPPORT;
80 : }
81 :
82 0 : HcclResult TopoinfoRanktableConcise::GetServerList(
83 : [[maybe_unused]] const nlohmann::json& obj, [[maybe_unused]] RankTable_t& clusterInfo)
84 : {
85 0 : return HCCL_E_NOT_SUPPORT;
86 : }
87 :
88 0 : HcclResult TopoinfoRanktableConcise::GetSingleServer(
89 : [[maybe_unused]] const nlohmann::json& serverListObj, [[maybe_unused]] u32 objIndex,
90 : [[maybe_unused]] RankTable_t& clusterInfo)
91 : {
92 0 : return HCCL_E_NOT_SUPPORT;
93 : }
94 :
95 0 : HcclResult TopoinfoRanktableConcise::GetDeviceList(
96 : [[maybe_unused]] const nlohmann::json& serverListObj, [[maybe_unused]] u32 objIndex,
97 : [[maybe_unused]] RankTable_t& clusterInfo, [[maybe_unused]] std::string& serverId, [[maybe_unused]] u32& serverIdx,
98 : [[maybe_unused]] HcclIpAddress& hostIp)
99 : {
100 0 : return HCCL_E_NOT_SUPPORT;
101 : }
102 :
103 0 : HcclResult TopoinfoRanktableConcise::GetSingleDevice(
104 : [[maybe_unused]] const nlohmann::json& deviceListObj, [[maybe_unused]] u32 objIndex,
105 : [[maybe_unused]] RankTable_t& clusterInfo, [[maybe_unused]] std::string& serverId, [[maybe_unused]] u32& serverIdx,
106 : [[maybe_unused]] HcclIpAddress& hostIp)
107 : {
108 0 : return HCCL_E_NOT_SUPPORT;
109 : }
110 :
111 0 : HcclResult TopoinfoRanktableConcise::SplitString(
112 : [[maybe_unused]] const std::string& str, [[maybe_unused]] const std::string& strC,
113 : [[maybe_unused]] std::vector<std::string>& strVector) const
114 : {
115 0 : return HCCL_E_NOT_SUPPORT;
116 : }
117 :
118 0 : HcclResult TopoinfoRanktableConcise::GetSingleDeviceIp(
119 : [[maybe_unused]] const nlohmann::json& deviceListObj, [[maybe_unused]] u32 objIndex,
120 : [[maybe_unused]] RankTable_t& clusterInfo, [[maybe_unused]] RankInfo_t& rankinfo,
121 : [[maybe_unused]] DevType deviceType, [[maybe_unused]] bool invalidHostIp)
122 : {
123 0 : return HCCL_E_NOT_SUPPORT;
124 : }
125 :
126 0 : HcclResult TopoinfoRanktableConcise::GetSingleBackupDeviceIp(
127 : [[maybe_unused]] const nlohmann::json& deviceListObj, [[maybe_unused]] u32 objIndex,
128 : [[maybe_unused]] RankInfo_t& rankinfo)
129 : {
130 0 : return HCCL_E_NOT_SUPPORT;
131 : }
132 :
133 0 : HcclResult TopoinfoRanktableConcise::GetSingleDeviceHostPort(
134 : [[maybe_unused]] const nlohmann::json& deviceListObj, [[maybe_unused]] u32 objIndex,
135 : [[maybe_unused]] RankInfo_t& rankinfo)
136 : {
137 0 : return HCCL_E_NOT_SUPPORT;
138 : }
139 :
140 0 : HcclResult TopoinfoRanktableConcise::GetSingleDevicePort(
141 : [[maybe_unused]] const nlohmann::json& deviceListObj, [[maybe_unused]] u32 objIndex,
142 : [[maybe_unused]] RankInfo_t& rankinfo)
143 : {
144 0 : return HCCL_E_NOT_SUPPORT;
145 : }
146 :
147 0 : HcclResult TopoinfoRanktableConcise::GetSingleBackupDevicePort(
148 : [[maybe_unused]] const nlohmann::json& deviceListObj, [[maybe_unused]] u32 objIndex,
149 : [[maybe_unused]] RankInfo_t& rankinfo)
150 : {
151 0 : return HCCL_E_NOT_SUPPORT;
152 : }
153 :
154 0 : HcclResult TopoinfoRanktableConcise::VerifyBackupDeviceIpAndPort(
155 : [[maybe_unused]] std::vector<RankInfo_t>& rankList, [[maybe_unused]] u32 devIndex)
156 : {
157 0 : return HCCL_E_NOT_SUPPORT;
158 : }
159 :
160 0 : HcclResult TopoinfoRanktableConcise::GetSingleSuperDeviceId(
161 : [[maybe_unused]] const nlohmann::json& deviceListObj, [[maybe_unused]] u32 objIndex,
162 : [[maybe_unused]] RankTable_t& clusterInfo, [[maybe_unused]] RankInfo_t& rankinfo)
163 : {
164 0 : return HCCL_E_NOT_SUPPORT;
165 : }
166 :
167 0 : HcclResult TopoinfoRanktableConcise::GetSuperPodList(
168 : [[maybe_unused]] const nlohmann::json& obj, [[maybe_unused]] RankTable_t& clusterInfo)
169 : {
170 0 : return HCCL_E_NOT_SUPPORT;
171 : }
172 :
173 0 : HcclResult TopoinfoRanktableConcise::GetSingleSuperPod(
174 : [[maybe_unused]] const nlohmann::json& superPodList, [[maybe_unused]] u32 objIndex,
175 : [[maybe_unused]] RankTable_t& clusterInfo)
176 : {
177 0 : return HCCL_E_NOT_SUPPORT;
178 : }
179 :
180 0 : HcclResult TopoinfoRanktableConcise::GetSuperPodServerList(
181 : [[maybe_unused]] const nlohmann::json& superPodList, [[maybe_unused]] u32 objIndex,
182 : [[maybe_unused]] RankTable_t& clusterInfo, [[maybe_unused]] std::string superPodId)
183 : {
184 0 : return HCCL_E_NOT_SUPPORT;
185 : }
186 :
187 0 : HcclResult TopoinfoRanktableConcise::GetSingleSuperPodSever(
188 : [[maybe_unused]] const nlohmann::json& superPodServerList, [[maybe_unused]] u32 objIndex,
189 : [[maybe_unused]] RankTable_t& clusterInfo, [[maybe_unused]] std::string superPodId)
190 : {
191 0 : return HCCL_E_NOT_SUPPORT;
192 : }
193 :
194 0 : HcclResult TopoinfoRanktableConcise::CheckSuperPodInfo([[maybe_unused]] RankTable_t& clusterInfo) const
195 : {
196 0 : return HCCL_E_NOT_SUPPORT;
197 : }
198 :
199 1 : HcclResult TopoinfoRanktableConcise::GetSingleNicInfo(
200 : [[maybe_unused]] const nlohmann::json& serverListObj, [[maybe_unused]] u32 objIndex,
201 : [[maybe_unused]] RankInfo_t& rankinfo)
202 : {
203 1 : return HCCL_E_NOT_SUPPORT;
204 : }
|