LCOV - code coverage report
Current view: top level - base_comm/common - dlurma_function.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 0.0 % 4 0
Test Date: 2026-08-18 17:47:01 Functions: 0.0 % 1 0

            Line data    Source code
       1              : /**
       2              :  * Copyright (c) 2026 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_SRC_DLURMAFUNCTION_H
      12              : #define HCCL_SRC_DLURMAFUNCTION_H
      13              : 
      14              : #include <functional>
      15              : #include <mutex>
      16              : #include <hccl/hccl_types.h>
      17              : #include "hccl/base.h"
      18              : #include "urma_api.h"
      19              : 
      20              : namespace hcomm {
      21              : class DlUrmaFunction {
      22              : public:
      23              :     virtual ~DlUrmaFunction();
      24              :     static DlUrmaFunction& GetInstance();
      25              :     HcclResult DlUrmaFunctionInit();
      26              :     std::function<urma_status_t(urma_jetty_t* jetty, urma_jfs_wr_t* wr, urma_jfs_wr_t** bad_wr)> dlUrmaPostJettySendWr
      27              :         = nullptr;
      28              :     std::function<int(urma_jfc_t* jfc, int cr_cnt, urma_cr_t* cr)> dlUrmaPollJfc = nullptr;
      29              : 
      30            0 :     bool DlUrmaFunctionIsInit()
      31              :     {
      32            0 :         std::lock_guard<std::mutex> lock(handleMutex_);
      33            0 :         return (handle_ != nullptr);
      34            0 :     }
      35              : 
      36              : protected:
      37              : private:
      38              :     void* handle_{nullptr};
      39              :     std::mutex handleMutex_;
      40              :     DlUrmaFunction(const DlUrmaFunction&);
      41              :     DlUrmaFunction& operator=(const DlUrmaFunction&);
      42              :     DlUrmaFunction();
      43              :     HcclResult DlUrmaFunctionApiInit();
      44              : };
      45              : } // namespace hcomm
      46              : 
      47              : #endif // HCCL_SRC_DLURMAFUNCTION_H
        

Generated by: LCOV version 2.0-1