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 HCCLV2_TOPO_MATCH_NHR
12 : #define HCCLV2_TOPO_MATCH_NHR
13 : #include <string>
14 : #include <vector>
15 : #include <map>
16 :
17 : #include "types.h"
18 : #include "dev_type.h"
19 : #include "topo_match_base.h"
20 : #include "rank_gph.h"
21 :
22 : namespace Hccl {
23 :
24 : class TopoMatchNHR : public TopoMatchBase {
25 : public:
26 : explicit TopoMatchNHR(const RankId vRank, const u32 rankSize, const RankGraph* rankGraph, const DevType devType);
27 : ~TopoMatchNHR() override;
28 :
29 0 : std::string Describe() const override { return "Topo Match for NHR Algorithm (CURRENTLY only 950 is supported)."; }
30 : using TopoMatchBase::MatchTopo;
31 : HcclResult MatchTopo(
32 : std::vector<std::vector<RankId>>& vTopo, std::vector<RankId>& virtRanks,
33 : std::map<RankId, u32>& virtRankMap) override;
34 :
35 : private:
36 : HcclResult NHRTopoForAllRanks();
37 : u32 GetNHRStepNum(u32 rankSize) const;
38 : std::vector<RankId> rankIds_; // virtualTopoRank
39 : std::vector<std::vector<RankId>> rankOnSameBoardVector_; // ranks vector with same boardIds in rack
40 : std::vector<std::vector<RankId>> rankOnSameSlotVector_; // ranks vector with same slotIds in rack
41 : std::vector<u32> numRanksPerBoard_; // ranks num with same boardIds in rack
42 : };
43 : } // namespace Hccl
44 :
45 : #endif // !HCCLV2_TOPO_MATCH_NHR
|