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 "hccl_communicator_attrs.h"
12 :
13 : using namespace std;
14 :
15 : namespace hccl {
16 : HcclResult
17 1 : HcclCommunicatorAttrs::Init([[maybe_unused]] HcclCommParams& params, [[maybe_unused]] const RankTable_t& rankTable)
18 : {
19 1 : return HCCL_SUCCESS;
20 : }
21 :
22 0 : HcclResult HcclCommunicatorAttrs::Init(
23 : [[maybe_unused]] HcclCommParams& params, [[maybe_unused]] const RankTable_t& rankTable,
24 : [[maybe_unused]] const std::map<HcclCMDType, std::vector<HcclAlgoType>>& algoConfigMap)
25 : {
26 0 : return HCCL_SUCCESS;
27 : }
28 :
29 1 : HcclResult HcclCommunicatorAttrs::Init(
30 : [[maybe_unused]] HcclCommParams& params, [[maybe_unused]] const std::vector<RankInfo>& rankList,
31 : [[maybe_unused]] WorldGroupInfo& groupCommonData)
32 : {
33 1 : return HCCL_SUCCESS;
34 : }
35 :
36 0 : HcclResult HcclCommunicatorAttrs::Init(
37 : [[maybe_unused]] HcclCommParams& params, [[maybe_unused]] const std::vector<RankInfo>& rankList,
38 : [[maybe_unused]] WorldGroupInfo& groupCommonData,
39 : [[maybe_unused]] const std::map<HcclCMDType, std::vector<HcclAlgoType>>& algoConfigMap)
40 : {
41 0 : return HCCL_SUCCESS;
42 : }
43 :
44 1 : bool HcclCommunicatorAttrs::IsStandardCard() { return false; }
45 :
46 1 : bool HcclCommunicatorAttrs::Is310PDuoCard() { return false; }
47 :
48 1 : bool HcclCommunicatorAttrs::IsCommon310P3DUO([[maybe_unused]] const std::vector<RankInfo_t>& rankList) { return false; }
49 :
50 1 : bool HcclCommunicatorAttrs::CompareWithUserRank(
51 : [[maybe_unused]] const RankInfo& left, [[maybe_unused]] const RankInfo& right)
52 : {
53 1 : return false;
54 : }
55 :
56 1 : HcclResult HcclCommunicatorAttrs::CheckDeviceType([[maybe_unused]] const DevType deviceType) const
57 : {
58 1 : return HCCL_SUCCESS;
59 : }
60 :
61 1 : HcclResult HcclCommunicatorAttrs::GetNicInfo(
62 : [[maybe_unused]] const NICDeployment& nicDeploy, [[maybe_unused]] const u32 curRankIndex,
63 : [[maybe_unused]] const std::vector<RankInfo_t>& servRankList, [[maybe_unused]] RankInfo& rankInfo) const
64 : {
65 1 : return HCCL_SUCCESS;
66 : }
67 :
68 : // private
69 1 : HcclResult HcclCommunicatorAttrs::InitCommParams([[maybe_unused]] HcclCommParams& params) { return HCCL_SUCCESS; }
70 :
71 1 : HcclResult HcclCommunicatorAttrs::SetServerId([[maybe_unused]] const RankTable_t& rankTable) { return HCCL_SUCCESS; }
72 :
73 1 : HcclResult HcclCommunicatorAttrs::SetServerNum([[maybe_unused]] const std::vector<RankInfo_t>& ranks)
74 : {
75 1 : return HCCL_SUCCESS;
76 : }
77 :
78 1 : HcclResult HcclCommunicatorAttrs::SetInnerServerAverageDevice([[maybe_unused]] const RankTable_t& rankTable)
79 : {
80 1 : return HCCL_SUCCESS;
81 : }
82 :
83 : // sub group适配获取server内设配数
84 1 : HcclResult HcclCommunicatorAttrs::SetInnerServerAverageDevice([[maybe_unused]] const std::vector<RankInfo>& rankList)
85 : {
86 1 : return HCCL_SUCCESS;
87 : }
88 :
89 1 : HcclResult HcclCommunicatorAttrs::TransformRankInfoByServerId(
90 : [[maybe_unused]] const std::vector<RankInfo_t>& rankList, [[maybe_unused]] ServRankInfo& servRankInfo) const
91 : {
92 1 : return HCCL_SUCCESS;
93 : }
94 :
95 1 : bool HcclCommunicatorAttrs::CompareWithDevicePhyId(
96 : [[maybe_unused]] const RankInfo_t& left, [[maybe_unused]] const RankInfo_t& right)
97 : {
98 1 : return false;
99 : }
100 :
101 1 : HcclResult HcclCommunicatorAttrs::SetModuleInfo([[maybe_unused]] const std::vector<RankInfo_t>& rankList)
102 : {
103 1 : return HCCL_SUCCESS;
104 : }
105 :
106 1 : HcclResult HcclCommunicatorAttrs::SetSuperPodInfo([[maybe_unused]] const std::vector<RankInfo_t>& rankList)
107 : {
108 1 : return HCCL_SUCCESS;
109 : }
110 :
111 : // 集群中存在910B A+X时,0-7卡: moduleIdx = 2 * serverIdx; 8-15卡: moduleIdx = 2 * serverIdx + 1
112 : // 集群中不存在910B A+X时,moduleIdx = serverIdx
113 : HcclResult
114 1 : HcclCommunicatorAttrs::GetModuleIdx([[maybe_unused]] const RankInfo_t& rankInfo, [[maybe_unused]] u32& moduleIdx)
115 : {
116 1 : return HCCL_SUCCESS;
117 : }
118 :
119 : // 用于标识集群中是否存在 910B A+X形态
120 1 : bool HcclCommunicatorAttrs::IsDiffDeviceModule([[maybe_unused]] const std::vector<RankInfo_t>& rankList) const
121 : {
122 1 : return false;
123 : }
124 :
125 1 : HcclResult HcclCommunicatorAttrs::InitHccsPortNum() { return HCCL_SUCCESS; }
126 :
127 1 : HcclResult HcclCommunicatorAttrs::SetRankInfoList([[maybe_unused]] const RankTable_t& rankTable)
128 : {
129 1 : return HCCL_SUCCESS;
130 : }
131 :
132 1 : HcclResult HcclCommunicatorAttrs::CheckRankTable(
133 : [[maybe_unused]] const RankTable_t& rankTable, [[maybe_unused]] const ServRankInfo& servRankInfo)
134 : {
135 1 : return HCCL_SUCCESS;
136 : }
137 :
138 1 : HcclResult HcclCommunicatorAttrs::CheckDevPhyId([[maybe_unused]] const s32& devicePhyId) const { return HCCL_SUCCESS; }
139 :
140 1 : HcclResult HcclCommunicatorAttrs::SortRankInfoList() { return HCCL_SUCCESS; }
141 :
142 1 : HcclResult HcclCommunicatorAttrs::CheckNicDeploy(
143 : [[maybe_unused]] NICDeployment nicDeploy, [[maybe_unused]] DevType deviceType) const
144 : {
145 1 : return HCCL_SUCCESS;
146 : }
147 :
148 1 : HcclResult HcclCommunicatorAttrs::CheckDevCount([[maybe_unused]] const u32 devNum) { return HCCL_SUCCESS; }
149 :
150 1 : bool HcclCommunicatorAttrs::Check2N([[maybe_unused]] u32 num) const { return false; }
151 :
152 1 : HcclResult HcclCommunicatorAttrs::SetLocalRankInfo() { return HCCL_SUCCESS; }
153 :
154 1 : HcclResult HcclCommunicatorAttrs::SetLocalRankInfoSubGroup([[maybe_unused]] const std::vector<RankInfo>& rankList)
155 : {
156 1 : return HCCL_SUCCESS;
157 : }
158 :
159 1 : HcclResult HcclCommunicatorAttrs::CheckLocalRankInfo() { return HCCL_SUCCESS; }
160 :
161 1 : u32 HcclCommunicatorAttrs::CalMeshAggRankSize([[maybe_unused]] int halfDevNum) const { return 0; }
162 :
163 1 : HcclResult HcclCommunicatorAttrs::SetMeshAggregationRankSize([[maybe_unused]] u32 size) { return HCCL_SUCCESS; }
164 :
165 1 : HcclResult HcclCommunicatorAttrs::CalAndSetMeshAggRankSize() { return HCCL_SUCCESS; }
166 :
167 1 : HcclResult HcclCommunicatorAttrs::SetWorldGroupInfo(
168 : [[maybe_unused]] std::unordered_map<std::string, std::map<u32, HcclIpAddress>>& phyIdNicInfoMap,
169 : [[maybe_unused]] std::vector<RankInfo>& worldRankInfoList, [[maybe_unused]] std::vector<u32>& nicRanksPort,
170 : [[maybe_unused]] std::vector<u32>& vnicRanksPort)
171 : {
172 1 : return HCCL_SUCCESS;
173 : }
174 :
175 1 : HcclResult HcclCommunicatorAttrs::TransformRankList(
176 : [[maybe_unused]] const std::vector<RankInfo>& rankListIn, [[maybe_unused]] std::vector<RankInfo_t>& rankListOut)
177 : {
178 1 : return HCCL_SUCCESS;
179 : }
180 :
181 1 : bool HcclCommunicatorAttrs::IsEnableRoce() { return false; }
182 :
183 : // a+x mesh间需要同时保证ip有效和roce开关打开才能走rdma
184 1 : bool HcclCommunicatorAttrs::IsUsedRdmaLevel0AndIpInvalid() { return false; }
185 :
186 1 : bool HcclCommunicatorAttrs::IsSupportEnableRoce() { return false; }
187 :
188 1 : void HcclCommunicatorAttrs::GetTopoAttr([[maybe_unused]] HcclTopoAttr& topoAttr) {}
189 :
190 1 : void HcclCommunicatorAttrs::GetAlgoAttr([[maybe_unused]] HcclAlgoAttr& algoAttr) {}
191 :
192 1 : u32 HcclCommunicatorAttrs::GetLocalNicPort([[maybe_unused]] NicType nicType) { return 0; }
193 : } // namespace hccl
|