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