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 HCCL_AICPU_COMMUNICATOR_MANAGER_LITE_H_
12 : #define HCCL_AICPU_COMMUNICATOR_MANAGER_LITE_H_
13 :
14 : #include "communicator_impl_lite.h"
15 :
16 : namespace Hccl {
17 : class CommunicatorImplLiteMgr {
18 : public:
19 : CommunicatorImplLiteMgr();
20 : ~CommunicatorImplLiteMgr();
21 : static CommunicatorImplLiteMgr& GetInstance();
22 : void DestroyComm(u32 commIdIndex);
23 : CommunicatorImplLite* Get(const u32 commIdIndex);
24 : std::vector<CommunicatorImplLite*> GetAll();
25 :
26 6 : void SetEnvConfig(const HcclDeviceEnvConfigLite& envConfig) { envConfig_ = envConfig; }
27 7 : const HcclDeviceEnvConfigLite& GetEnvConfig() { return envConfig_; }
28 :
29 : private:
30 : std::unordered_map<u32, std::unique_ptr<CommunicatorImplLite>> communicatorImplLites;
31 : std::mutex serialMutex;
32 : HcclDeviceEnvConfigLite envConfig_;
33 : };
34 :
35 : } // namespace Hccl
36 :
37 : #endif // HCCL_AICPU_COMMUNICATOR_MANAGER_LITE_H_
|