LCOV - code coverage report
Current view: top level - legacy/ascend950/framework/communicator - hccl_params_pub.cc (source / functions) Coverage Total Hit
Test: coverage.info Lines: 87.5 % 48 42
Test Date: 2026-08-18 17:47:01 Functions: 93.3 % 15 14

            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              : #include <hccl_params_pub.h>
      12              : #include "exception_util.h"
      13              : #include "not_support_exception.h"
      14              : #include "string_util.h"
      15              : namespace Hccl {
      16            3 : std::string CollOpParams::Describe() const
      17              : {
      18            3 :     if (descOpMap.find(opType) != descOpMap.end()) {
      19            3 :         return descOpMap.at(opType).operator()(*this);
      20              :     } else {
      21            0 :         std::string msg = StringFormat("Does not support this operator=%s, please check.", opType.Describe().c_str());
      22            0 :         MACRO_THROW(NotSupportException, msg);
      23            0 :     }
      24              : }
      25              : 
      26            1 : std::string CollOpParams::DescReduceScatter(const CollOpParams& opParams)
      27              : {
      28              :     return StringFormat(
      29              :         "CollOpParams[opType=%s, dataType=%s, reduceOp=%s, recvCount=%llu, sendBuf=%p, recvBuf=%p]",
      30            3 :         opType.Describe().c_str(), opParams.dataType.Describe().c_str(), opParams.reduceOp.Describe().c_str(),
      31            4 :         opParams.count, opParams.sendBuf, opParams.recvBuf);
      32              : }
      33              : 
      34            1 : std::string CollOpParams::DescReduce(const CollOpParams& opParams)
      35              : {
      36              :     return StringFormat(
      37              :         "CollOpParams[opType=%s, dataType=%s, reduceOp=%s, recvCount=%llu, root=%u, sendBuf=%p, recvBuf=%p]",
      38            3 :         opType.Describe().c_str(), opParams.dataType.Describe().c_str(), opParams.reduceOp.Describe().c_str(),
      39            4 :         opParams.count, opParams.root, opParams.sendBuf, opParams.recvBuf);
      40              : }
      41              : 
      42            2 : std::string CollOpParams::DescAllreduce(const CollOpParams& opParams)
      43              : {
      44              :     return StringFormat(
      45              :         "CollOpParams[opType=%s, dataType=%s, reduceOp=%s, count=%llu, sendBuf=%p, recvBuf=%p]",
      46            6 :         opType.Describe().c_str(), opParams.dataType.Describe().c_str(), opParams.reduceOp.Describe().c_str(),
      47            8 :         opParams.count, opParams.sendBuf, opParams.recvBuf);
      48              : }
      49              : 
      50            1 : std::string CollOpParams::DescAllgather(const CollOpParams& opParams)
      51              : {
      52              :     return StringFormat(
      53            2 :         "CollOpParams[opType=%s, dataType=%s, sendCount=%llu, sendBuf=%p, recvBuf=%p]", opType.Describe().c_str(),
      54            3 :         opParams.dataType.Describe().c_str(), opParams.count, opParams.sendBuf, opParams.recvBuf);
      55              : }
      56              : 
      57            1 : std::string CollOpParams::DescScatter(const CollOpParams& opParams)
      58              : {
      59              :     return StringFormat(
      60              :         "CollOpParams[opType=%s, dataType=%s, sendCount=%llu, sendBuf=%p, recvBuf=%p, root=%u]",
      61            2 :         opType.Describe().c_str(), opParams.dataType.Describe().c_str(), opParams.count, opParams.sendBuf,
      62            3 :         opParams.recvBuf, opParams.root);
      63              : }
      64              : 
      65            1 : std::string CollOpParams::DescAlltoall(const CollOpParams& opParams)
      66              : {
      67              :     return StringFormat(
      68            1 :         "CollOpParams[opType=%s, sendCount=%llu, recvCount=%llu, sendType=%s, recvType=%s]", opType.Describe().c_str(),
      69            1 :         opParams.all2AllDataDes.sendCount, opParams.all2AllDataDes.recvCount,
      70            3 :         opParams.all2AllDataDes.sendType.Describe().c_str(), opParams.all2AllDataDes.recvType.Describe().c_str());
      71              : }
      72              : 
      73            1 : std::string CollOpParams::DescAlltoallV(const CollOpParams& opParams)
      74              : {
      75              :     return StringFormat(
      76            2 :         "CollOpParams[opType=%s, sendType=%s, recvType=%s]", opType.Describe().c_str(),
      77            3 :         opParams.all2AllVDataDes.sendType.Describe().c_str(), opParams.all2AllVDataDes.recvType.Describe().c_str());
      78              : }
      79              : 
      80            1 : std::string CollOpParams::DescAlltoallVC(const CollOpParams& opParams)
      81              : {
      82              :     return StringFormat(
      83            2 :         "CollOpParams[opType=%s, sendType=%s, recvType=%s]", opType.Describe().c_str(),
      84            3 :         opParams.all2AllVCDataDes.sendType.Describe().c_str(), opParams.all2AllVCDataDes.recvType.Describe().c_str());
      85              : }
      86              : 
      87            1 : std::string CollOpParams::DescSend(const CollOpParams& opParams)
      88              : {
      89              :     return StringFormat(
      90            2 :         "CollOpParams[opType=%s, dataType=%s, sendBuf=%p]", opType.Describe().c_str(),
      91            3 :         opParams.dataType.Describe().c_str(), opParams.sendBuf);
      92              : }
      93              : 
      94            1 : std::string CollOpParams::DescRecv(const CollOpParams& opParams)
      95              : {
      96              :     return StringFormat(
      97            2 :         "CollOpParams[opType=%s, dataType=%s, recvBuf=%p]", opType.Describe().c_str(),
      98            3 :         opParams.dataType.Describe().c_str(), opParams.recvBuf);
      99              : }
     100              : 
     101            2 : std::string CollOpParams::DescBroadcast(const CollOpParams& opParams)
     102              : {
     103              :     return StringFormat(
     104              :         "CollOpParams[opType=%s, dataType=%s, reduceOp=%s, recvCount=%llu, sendBuf=%p, recvBuf=%p]",
     105            6 :         opType.Describe().c_str(), opParams.dataType.Describe().c_str(), opParams.reduceOp.Describe().c_str(),
     106            8 :         opParams.count, opParams.sendBuf, opParams.recvBuf);
     107              : }
     108              : 
     109            1 : std::string CollOpParams::DescBatchSendRecv(const CollOpParams& opParams)
     110              : {
     111              :     return StringFormat(
     112            1 :         "CollOpParams[opType=%s, itemNum=%u", opType.Describe().c_str(), opParams.batchSendRecvDataDes.itemNum);
     113              : }
     114              : 
     115            1 : std::string CollOpParams::DescAllGatherV(const CollOpParams& opParams)
     116              : {
     117              :     return StringFormat(
     118            2 :         "CollOpParams[opType=%s, dataType=%s]", opType.Describe().c_str(),
     119            3 :         opParams.vDataDes.dataType.Describe().c_str());
     120              : }
     121              : 
     122            0 : std::string CollOpParams::DescReduceScatterV(const CollOpParams& opParams)
     123              : {
     124              :     return StringFormat(
     125            0 :         "CollOpParams[opType=%s, dataType=%s]", opType.Describe().c_str(),
     126            0 :         opParams.vDataDes.dataType.Describe().c_str());
     127              : }
     128              : } // namespace Hccl
        

Generated by: LCOV version 2.0-1