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 "endpoint_logger.h"
12 : #include "comm_addr_logger.h"
13 : #include "hccl_comm_pub.h"
14 :
15 : namespace hcomm {
16 : namespace logger {
17 :
18 7 : void EndpointLogger::PrintDeviceLocation(uint32_t idx, const char* endpointName, const EndpointLoc& loc)
19 : {
20 7 : HCCL_INFO(
21 : "[%s] channelDescs[%u] %s loc: locType[%d], devPhyId[%u], superDevId[%u], serverIdx[%u], superPodIdx[%u]",
22 : __func__, idx, endpointName, loc.locType, loc.device.devPhyId, loc.device.superDevId, loc.device.serverIdx,
23 : loc.device.superPodIdx);
24 7 : }
25 :
26 6 : void EndpointLogger::PrintHostLocation(uint32_t idx, const char* endpointName, const EndpointLoc& loc)
27 : {
28 6 : HCCL_INFO(
29 : "[%s] channelDescs[%u] %s loc: locType[%d], host.id[%u]", __func__, idx, endpointName, loc.locType,
30 : loc.host.id);
31 6 : }
32 :
33 14 : void EndpointLogger::PrintLocation(uint32_t idx, const char* endpointName, const EndpointLoc& loc)
34 : {
35 14 : if (loc.locType == ENDPOINT_LOC_TYPE_DEVICE) {
36 7 : PrintDeviceLocation(idx, endpointName, loc);
37 7 : } else if (loc.locType == ENDPOINT_LOC_TYPE_HOST) {
38 6 : PrintHostLocation(idx, endpointName, loc);
39 : } else {
40 1 : HCCL_INFO("[%s] channelDescs[%u] %s loc: locType[%d]", __func__, idx, endpointName, loc.locType);
41 : }
42 14 : }
43 :
44 11 : void EndpointLogger::Print(uint32_t idx, const char* endpointName, const EndpointDesc& endpointDesc)
45 : {
46 : // 打印通信地址
47 11 : CommAddrLogger::Print(idx, endpointName, endpointDesc.commAddr);
48 :
49 : // 打印位置信息
50 11 : PrintLocation(idx, endpointName, endpointDesc.loc);
51 11 : }
52 :
53 : } // namespace logger
54 : } // namespace hcomm
|