LCOV - code coverage report
Current view: top level - server/hccl - hccl_so_manager.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 1 1
Test Date: 2026-07-28 10:54:05 Functions: 100.0 % 1 1

            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_SO_MANAGER_H
      12              : #define HCCL_SO_MANAGER_H
      13              : 
      14              : #include <unordered_map>
      15              : #include <mutex>
      16              : #include <vector>
      17              : #include "hccl/hccl_ex.h"
      18              : #include "common/bqs_log.h"
      19              : 
      20              : namespace dgw {
      21              : using HcclInitCommFunc = HcclResult (*)(const char_t *, uint32_t, const CommAttr *, HcclComm *);
      22              : using HcclFinalizeCommFunc = HcclResult (*)(HcclComm);
      23              : 
      24              : // MPI API
      25              : using HcclIsendFunc = int32_t(*)(void *, int32_t, HcclDataType, int32_t, int32_t, HcclComm, HcclRequest *);
      26              : using HcclImrecvFunc = int32_t(*)(void *, int32_t, HcclDataType, HcclMessage *, HcclRequest *);
      27              : using HcclImprobeFunc = int32_t(*)(int32_t, int32_t, HcclComm, int32_t *, HcclMessage *, HcclStatus *);
      28              : using HcclGetCountFunc = int32_t(*)(const HcclStatus *, HcclDataType, int32_t *);
      29              : using HcclTestSomeFunc = int32_t(*)(int32_t, HcclRequest[], int32_t *, int32_t[], HcclStatus[]);
      30              : 
      31              : using HcclRegisterMemoryFunc = HcclResult (*)(HcclComm, void*, uint64_t);
      32              : using HcclUnregisterMemoryFunc = HcclResult (*)(HcclComm, void*);
      33              : using HcclSetGrpIdCallback = HcclResult (*)(int32_t(*)(int32_t, int32_t*, int32_t*));
      34              : 
      35              : 
      36              : class HcclSoManager {
      37              : public:
      38              :     static HcclSoManager *GetInstance();
      39              : 
      40              :     virtual ~HcclSoManager();
      41              : 
      42              :     /**
      43              :      * load hccl so
      44              :      */
      45              :     void LoadSo();
      46              : 
      47              :     /**
      48              :      * unload hccl so
      49              :      */
      50              :     void UnloadSo();
      51              : 
      52              :     /**
      53              :      * get function
      54              :      * @param name hccl function name
      55              :      * @return void *
      56              :      */
      57              :     void *GetFunc(const std::string &name) const;
      58              : 
      59              : private:
      60            1 :     HcclSoManager() = default;
      61              : 
      62              :     std::unordered_map<std::string, void *> funcMap_;
      63              :     void *soHandle_ = nullptr;
      64              : };
      65              : }
      66              : #endif // HCCL_SO_MANAGER_H
        

Generated by: LCOV version 2.0-1