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 P2P_MGMT_PUB_H
12 : #define P2P_MGMT_PUB_H
13 :
14 : #include <map>
15 : #include <mutex>
16 : #include <vector>
17 : #include <atomic>
18 : #include "hccl/hccl_types.h"
19 :
20 : namespace hccl {
21 : enum class P2PStatus { P2P_STATUS_DISABLED = 0, P2P_STATUS_ENABLING, P2P_STATUS_ENABLED };
22 :
23 : using P2PConnectionInfo = struct P2PConnectionInfoDef {
24 : uint32_t reference = 0;
25 : P2PStatus status = P2PStatus::P2P_STATUS_DISABLED;
26 : };
27 :
28 : class P2PMgmt;
29 : class P2PMgmtPub {
30 : public:
31 : static HcclResult EnableP2P(std::vector<uint32_t> remoteDevices);
32 : static HcclResult DisableP2P(std::vector<uint32_t> remoteDevices);
33 : static HcclResult WaitP2PEnabled(
34 0 : std::vector<uint32_t> remoteDevices, std::function<bool()> needStop = []() {
35 0 : return false;
36 : });
37 : };
38 : } // namespace hccl
39 :
40 : #endif // P2P_MGMT_H
|