已合并
[fix]日志整改 #4874
devHaven创建于 16 天前
[fix]日志整改 #4874
已合并
共 20 个文件变更+137-56
| @@ -193,7 +193,8 @@ HcclResult HostCpuRoceChannel::BuildSocket() | |||
| 193 | uint16_t port = channelDesc_.port; | 193 | uint16_t port = channelDesc_.port; |
| 194 | if (port == 0) { | 194 | if (port == 0) { |
| 195 | port = DEFAULT_LISTENING_PORT; | 195 | port = DEFAULT_LISTENING_PORT; |
| 196 | - HCCL_INFO("[HostCpuRoceChannel::%s] channelDesc port is 0, use default port [%u]", __func__, port); | 196 | + HCCL_INFO( |
| 197 | + "[HostCpuRoceChannel::%s] channelDesc port is 0, use default port [%u] for BuildSocket", __func__, port); | ||
| 197 | } | 198 | } |
| 198 | std::string socketTag = "AUTOMATIC_SOCKET_TAG"; | 199 | std::string socketTag = "AUTOMATIC_SOCKET_TAG"; |
| 199 | Hccl::SocketConfig socketConfig | 200 | Hccl::SocketConfig socketConfig |
| @@ -201,7 +202,7 @@ HcclResult HostCpuRoceChannel::BuildSocket() | |||
| 201 | Hccl::SocketConfig(linkData, port, socketTag, channelDesc_.role == HCOMM_SOCKET_ROLE_SERVER) : | 202 | Hccl::SocketConfig(linkData, port, socketTag, channelDesc_.role == HCOMM_SOCKET_ROLE_SERVER) : |
| 202 | Hccl::SocketConfig(linkData, port, socketTag); | 203 | Hccl::SocketConfig(linkData, port, socketTag); |
| 203 | CHK_RET(hcomm::SocketMgr::GetInstance(devicePhyId_).GetSocket(socketConfig, socket_)); | 204 | CHK_RET(hcomm::SocketMgr::GetInstance(devicePhyId_).GetSocket(socketConfig, socket_)); |
| 204 | - HCCL_INFO("[HostCpuRoceChannel::%s] SUCCESS. port[%u].", __func__, port); | 205 | + HCCL_INFO("[HostCpuRoceChannel::%s] BuildSocket SUCCESS. port[%u].", __func__, port); |
| 205 | return HCCL_SUCCESS; | 206 | return HCCL_SUCCESS; |
| 206 | } | 207 | } |
| 207 | 208 | ||
| @@ -29,21 +29,21 @@ _executor_instance = None | |||
| 29 | 29 | ||
| 30 | 30 | ||
| 31 | def signal_handler(sig, frame): | 31 | def signal_handler(sig, frame): |
| 32 | - """处理Ctrl+C信号的函数""" | 32 | + """Handle Ctrl+C signal.""" |
| 33 | - common.log_info("\n\033[33m接收到Ctrl+C,正在关闭所有连接...\033[0m") | 33 | + common.log_info("\n\033[33mReceived Ctrl+C, closing all connections...\033[0m") |
| 34 | if _executor_instance: | 34 | if _executor_instance: |
| 35 | _executor_instance.force_close() | 35 | _executor_instance.force_close() |
| 36 | 36 | ||
| 37 | 37 | ||
| 38 | def setup_signal_handler(executor): | 38 | def setup_signal_handler(executor): |
| 39 | - """设置信号处理器""" | 39 | + """Set up signal handler.""" |
| 40 | global _executor_instance | 40 | global _executor_instance |
| 41 | _executor_instance = executor | 41 | _executor_instance = executor |
| 42 | signal.signal(signal.SIGINT, signal_handler) | 42 | signal.signal(signal.SIGINT, signal_handler) |
| 43 | 43 | ||
| 44 | 44 | ||
| 45 | def setup_logger(host_path, host_name): | 45 | def setup_logger(host_path, host_name): |
| 46 | - """为每个主机设置独立的logger""" | 46 | + """Set up an independent logger for each host.""" |
| 47 | return common.setup_file_logger(host_path, log_dir, _enable_logger_ref["value"]) | 47 | return common.setup_file_logger(host_path, log_dir, _enable_logger_ref["value"]) |
| 48 | 48 | ||
| 49 | 49 | ||
| @@ -69,9 +69,9 @@ class ParallelSSHExecutor: | |||
| 69 | context.logger.info(f"command: {original_cmd}") | 69 | context.logger.info(f"command: {original_cmd}") |
| 70 | 70 | ||
| 71 | def force_close(self): | 71 | def force_close(self): |
| 72 | - """强制关闭所有连接""" | 72 | + """Forcefully close all connections.""" |
| 73 | self.force_closing = True | 73 | self.force_closing = True |
| 74 | - common.log_info("\033[33m正在强制关闭所有SSH连接...\033[0m") | 74 | + common.log_info("\033[33mForcefully closing all SSH connections...\033[0m") |
| 75 | 75 | ||
| 76 | # 首先尝试正常关闭所有客户端 | 76 | # 首先尝试正常关闭所有客户端 |
| 77 | for client in self.clients[::-1]: | 77 | for client in self.clients[::-1]: |
| @@ -94,7 +94,8 @@ class ParallelSSHExecutor: | |||
| 94 | if alive_threads: | 94 | if alive_threads: |
| 95 | self.completed = False | 95 | self.completed = False |
| 96 | common.log_error( | 96 | common.log_error( |
| 97 | - "\033[31m有些线程无法正常结束,请确认远端命令是否仍在运行。\033[0m" | 97 | + "\033[31mSome threads cannot terminate normally, please check if remote " |
| 98 | + "commands are still running.\033[0m" | ||
| 98 | ) | 99 | ) |
| 99 | 100 | ||
| 100 | def exec_realtime_commands(self, context): | 101 | def exec_realtime_commands(self, context): |
| @@ -155,10 +156,11 @@ class ParallelSSHExecutor: | |||
| 155 | if self.force_closing: | 156 | if self.force_closing: |
| 156 | return | 157 | return |
| 157 | common.log_error( | 158 | common.log_error( |
| 158 | - f"\033[31m[{context.host:<{self._ipv4_print_len}}] 执行命令时发生错误: {str(err)}\033[0m" | 159 | + f"\033[31m[{context.host:<{self._ipv4_print_len}}] error occurred while executing command: " |
| 160 | + f"{str(err)}\033[0m" | ||
| 159 | ) | 161 | ) |
| 160 | if context.logger: | 162 | if context.logger: |
| 161 | - context.logger.error(f"执行命令时发生错误: {str(err)}") | 163 | + context.logger.error(f"error occurred while executing command: {str(err)}") |
| 162 | 164 | ||
| 163 | def _log_realtime_line(self, context, line): | 165 | def _log_realtime_line(self, context, line): |
| 164 | common.log_info(f"[{context.host:<{self._ipv4_print_len}}] {line.rstrip()}") | 166 | common.log_info(f"[{context.host:<{self._ipv4_print_len}}] {line.rstrip()}") |
| @@ -250,7 +252,7 @@ class ParallelSSHExecutor: | |||
| 250 | self._recurse_realtime_child(target_cmd, client, task) | 252 | self._recurse_realtime_child(target_cmd, client, task) |
| 251 | except (paramiko.SSHException, OSError, RuntimeError, ValueError) as err: | 253 | except (paramiko.SSHException, OSError, RuntimeError, ValueError) as err: |
| 252 | if not self.force_closing: | 254 | if not self.force_closing: |
| 253 | - common.log_error(f"\033[31m连接 {task.host_name} 失败: {str(err)}\033[0m") | 255 | + common.log_error(f"\033[31mconnect to {task.host_name} failed: {str(err)}\033[0m") |
| 254 | 256 | ||
| 255 | def _realtime_exec_host(self, target_cmd, task): | 257 | def _realtime_exec_host(self, target_cmd, task): |
| 256 | host_name = task.host_name | 258 | host_name = task.host_name |
| @@ -298,5 +300,5 @@ if __name__ == "__main__": | |||
| 298 | executor.re_realtime_exec(commands) | 300 | executor.re_realtime_exec(commands) |
| 299 | executor.wait_and_close() | 301 | executor.wait_and_close() |
| 300 | except (paramiko.SSHException, OSError, RuntimeError, ValueError) as err: | 302 | except (paramiko.SSHException, OSError, RuntimeError, ValueError) as err: |
| 301 | - common.log_error(f"\033[31m程序执行出错: {str(err)}\033[0m") | 303 | + common.log_error(f"\033[31mprogram execution error: {str(err)}\033[0m") |
| 302 | executor.force_close() | 304 | executor.force_close() |
| @@ -78,9 +78,6 @@ u64 GetPlfDebugConfigValue() | |||
| 78 | return g_plfDebugConfig.load(std::memory_order_relaxed); | 78 | return g_plfDebugConfig.load(std::memory_order_relaxed); |
| 79 | } | 79 | } |
| 80 | 80 | ||
| 81 | -void SetPlfDebugConfigValue(u64 value) | 81 | +void SetPlfDebugConfigValue(u64 value) { g_plfDebugConfig.store(value, std::memory_order_relaxed); } |
| 82 | -{ | ||
| 83 | - g_plfDebugConfig.store(value, std::memory_order_relaxed); | ||
| 84 | -} | ||
| 85 | 82 | ||
| 86 | } // namespace Hccl | 83 | } // namespace Hccl |
| @@ -313,7 +313,9 @@ int RaPeerCtxCqCreate(struct RaCtxHandle *ctxHandle, struct CqInfoT *info, struc | |||
| 313 | int ret = 0; | 313 | int ret = 0; |
| 314 | 314 | ||
| 315 | CHK_PRT_RETURN(info->in.ub.mode != JFC_MODE_NORMAL, | 315 | CHK_PRT_RETURN(info->in.ub.mode != JFC_MODE_NORMAL, |
| 316 | - hccp_err("[init][ctx_cq]jfc_mode[%d] not support, phyId[%u]", info->in.ub.mode, phyId), -EINVAL); | 316 | + hccp_err("[init][ctx_cq]jfc_mode[%d] not support, only JFC_MODE_NORMAL is supported, phyId[%u]", |
| 317 | + info->in.ub.mode, phyId), | ||
| 318 | + -EINVAL); | ||
| 317 | 319 | ||
| 318 | RaRsSetDevInfo(&devInfo, phyId, ctxHandle->devIndex); | 320 | RaRsSetDevInfo(&devInfo, phyId, ctxHandle->devIndex); |
| 319 | RaCtxPrepareCqCreate(info, &cqAttr); | 321 | RaCtxPrepareCqCreate(info, &cqAttr); |
| @@ -358,7 +360,7 @@ int RaPeerCtxQpCreate(struct RaCtxHandle *ctxHandle, struct QpCreateAttr *qpAttr | |||
| 358 | int ret = 0; | 360 | int ret = 0; |
| 359 | 361 | ||
| 360 | CHK_PRT_RETURN(qpAttr->ub.mode != JETTY_MODE_URMA_NORMAL, | 362 | CHK_PRT_RETURN(qpAttr->ub.mode != JETTY_MODE_URMA_NORMAL, |
| 361 | - hccp_err("[init][ctx_cq]jetty_mode[%d] not support," | 363 | + hccp_err("[init][ctx_cq]jetty_mode[%d] not support, only JETTY_MODE_URMA_NORMAL is supported," |
| 362 | " phyId[%u]", | 364 | " phyId[%u]", |
| 363 | qpAttr->ub.mode, phyId), | 365 | qpAttr->ub.mode, phyId), |
| 364 | -EINVAL); | 366 | -EINVAL); |
| @@ -343,7 +343,7 @@ int RsDrvCreateCqWithAttrs(struct RsQpCb *qpCb, int isExt, struct CqExtAttr *cqA | |||
| 343 | if (isExt == 1) { | 343 | if (isExt == 1) { |
| 344 | qpCb->ibSendCq = RsIbvExpCreateCq(qpCb->rdevCb->ibCtx, cqAttr->sendCqDepth, NULL, channel, sendEqNum, &attr, | 344 | qpCb->ibSendCq = RsIbvExpCreateCq(qpCb->rdevCb->ibCtx, cqAttr->sendCqDepth, NULL, channel, sendEqNum, &attr, |
| 345 | &qpCb->qpResp.sendCqData); | 345 | &qpCb->qpResp.sendCqData); |
| 346 | - hccp_info("rs_ibv_exp_create_cq"); | 346 | + hccp_info("rs_ibv_exp_create_cq ibSendCq"); |
| 347 | } else { | 347 | } else { |
| 348 | qpCb->ibSendCq = RsIbvCreateCq(qpCb->rdevCb->ibCtx, cqAttr->sendCqDepth, NULL, channel, sendEqNum); | 348 | qpCb->ibSendCq = RsIbvCreateCq(qpCb->rdevCb->ibCtx, cqAttr->sendCqDepth, NULL, channel, sendEqNum); |
| 349 | } | 349 | } |
| @@ -354,7 +354,7 @@ int RsDrvCreateCqWithAttrs(struct RsQpCb *qpCb, int isExt, struct CqExtAttr *cqA | |||
| 354 | if (isExt == 1) { | 354 | if (isExt == 1) { |
| 355 | qpCb->ibRecvCq = RsIbvExpCreateCq(qpCb->rdevCb->ibCtx, cqAttr->recvCqDepth, NULL, channel, recvEqNum, &attr, | 355 | qpCb->ibRecvCq = RsIbvExpCreateCq(qpCb->rdevCb->ibCtx, cqAttr->recvCqDepth, NULL, channel, recvEqNum, &attr, |
| 356 | &qpCb->qpResp.recvCqData); | 356 | &qpCb->qpResp.recvCqData); |
| 357 | - hccp_info("rs_ibv_exp_create_cq"); | 357 | + hccp_info("rs_ibv_exp_create_cq ibRecvCq"); |
| 358 | } else { | 358 | } else { |
| 359 | qpCb->ibRecvCq = RsIbvCreateCq(qpCb->rdevCb->ibCtx, cqAttr->recvCqDepth, NULL, channel, recvEqNum); | 359 | qpCb->ibRecvCq = RsIbvCreateCq(qpCb->rdevCb->ibCtx, cqAttr->recvCqDepth, NULL, channel, recvEqNum); |
| 360 | } | 360 | } |
| @@ -63,7 +63,7 @@ STATIC int RsGetQpcb(struct RsRdevCb *rdevCb, uint32_t qpn, struct RsQpCb **qpCb | |||
| 63 | } | 63 | } |
| 64 | 64 | ||
| 65 | *qpCb = NULL; | 65 | *qpCb = NULL; |
| 66 | - hccp_err("qp_cb for qp %u is not available!", qpn); | 66 | + hccp_err("qp_cb for qp %u is not available", qpn); |
| 67 | 67 | ||
| 68 | return -ENODEV; | 68 | return -ENODEV; |
| 69 | } | 69 | } |
| @@ -474,15 +474,13 @@ STATIC int RsMrInfoSync(struct RsMrCb *mrCb) | |||
| 474 | CHK_PRT_RETURN(mrCb->qpCb->connInfo == NULL, hccp_warn("no conn available !"), 0); | 474 | CHK_PRT_RETURN(mrCb->qpCb->connInfo == NULL, hccp_warn("no conn available !"), 0); |
| 475 | 475 | ||
| 476 | CHK_PRT_RETURN(mrCb->qpCb->state == RS_QP_STATUS_REM_FD_CLOSE, | 476 | CHK_PRT_RETURN(mrCb->qpCb->state == RS_QP_STATUS_REM_FD_CLOSE, |
| 477 | - hccp_warn("remote qp fd closed," | 477 | + hccp_warn("remote qp fd closed, " |
| 478 | "can not use it anymore! status[%d](RS_QP_STATUS_REM_FD_CLOSE)", | 478 | "can not use it anymore! status[%d](RS_QP_STATUS_REM_FD_CLOSE)", |
| 479 | mrCb->qpCb->state), | 479 | mrCb->qpCb->state), |
| 480 | -EFAULT); | 480 | -EFAULT); |
| 481 | 481 | ||
| 482 | CHK_PRT_RETURN(mrCb->qpCb->connInfo->connfd == RS_FD_INVALID, | 482 | CHK_PRT_RETURN(mrCb->qpCb->connInfo->connfd == RS_FD_INVALID, |
| 483 | - hccp_warn("mr info sync failed! fd not ready!" | 483 | + hccp_warn("mr info sync failed! fd not ready! connfd[%d](RS_FD_INVALID)", mrCb->qpCb->connInfo->connfd), |
| 484 | - "connfd[%d](RS_FD_INVALID)", | ||
| 485 | - mrCb->qpCb->connInfo->connfd), | ||
| 486 | -ENETUNREACH); | 484 | -ENETUNREACH); |
| 487 | 485 | ||
| 488 | mrCb->mrInfo.cmd = (unsigned int)RS_CMD_MR_INFO; | 486 | mrCb->mrInfo.cmd = (unsigned int)RS_CMD_MR_INFO; |
| @@ -638,10 +636,7 @@ RS_ATTRI_VISI_DEF int RsMrDereg(unsigned int phyId, unsigned int rdevIndex, unsi | |||
| 638 | CHK_PRT_RETURN(ret, hccp_err("rs_qpn2qpcb failed ret[%d]", ret), ret); | 636 | CHK_PRT_RETURN(ret, hccp_err("rs_qpn2qpcb failed ret[%d]", ret), ret); |
| 639 | 637 | ||
| 640 | CHK_PRT_RETURN(RsGetMrcb(qpCb, (uintptr_t)addr, &mrCb, &qpCb->mrList), | 638 | CHK_PRT_RETURN(RsGetMrcb(qpCb, (uintptr_t)addr, &mrCb, &qpCb->mrList), |
| 641 | - hccp_err("rs_get_mrcb failed " | 639 | + hccp_err("rs_get_mrcb failed, qpn[%u] addr[0x%llx]", qpn, (unsigned long long)(uintptr_t)addr), -EFAULT); |
| 642 | - "g_rs_send_wr_num[%u]", | ||
| 643 | - gRsSendWrNum), | ||
| 644 | - -EFAULT); | ||
| 645 | 640 | ||
| 646 | ret = RsDrvMrDereg(mrCb->ibMr); | 641 | ret = RsDrvMrDereg(mrCb->ibMr); |
| 647 | CHK_PRT_RETURN(ret, hccp_err("rs_drv_mr_dereg failed ret[%d] ", ret), -EACCES); | 642 | CHK_PRT_RETURN(ret, hccp_err("rs_drv_mr_dereg failed ret[%d] ", ret), -EACCES); |
| @@ -769,12 +764,14 @@ STATIC int RsInitTypicalMrCb(unsigned int phyId, struct RdmaMrRegInfo *mrRegInfo | |||
| 769 | 764 | ||
| 770 | if (devCb->rsCb->hccpMode == NETWORK_PEER_ONLINE || devCb->rsCb->hccpMode == NETWORK_ONLINE) { | 765 | if (devCb->rsCb->hccpMode == NETWORK_PEER_ONLINE || devCb->rsCb->hccpMode == NETWORK_ONLINE) { |
| 771 | mrCb->ibMr = RsDrvMrReg(devCb->ibPd, addr, len, access); | 766 | mrCb->ibMr = RsDrvMrReg(devCb->ibPd, addr, len, access); |
| 772 | - CHK_PRT_RETURN(mrCb->ibMr == NULL, hccp_err("rs_drv_mr_reg addr is NULL len[%lld] failed", len), -EACCES); | 767 | + CHK_PRT_RETURN(mrCb->ibMr == NULL, |
| 768 | + hccp_err("rs_drv_mr_reg ibMr is NULL len[%lld] failed, errno:%d", len, errno), -EACCES); | ||
| 773 | } else { | 769 | } else { |
| 774 | ret = RsMrPrepareRoceSign(phyId, devCb, &roceSign); | 770 | ret = RsMrPrepareRoceSign(phyId, devCb, &roceSign); |
| 775 | CHK_PRT_RETURN(ret != 0, hccp_err("RsMrPrepareRoceSign failed, ret(%d)", ret), ret); | 771 | CHK_PRT_RETURN(ret != 0, hccp_err("RsMrPrepareRoceSign failed, ret(%d)", ret), ret); |
| 776 | mrCb->ibMr = RsDrvExpMrReg(devCb->ibPd, addr, len, access, roceSign); | 772 | mrCb->ibMr = RsDrvExpMrReg(devCb->ibPd, addr, len, access, roceSign); |
| 777 | - CHK_PRT_RETURN(mrCb->ibMr == NULL, hccp_err("rs_drv_exp_mr_reg addr is NULL len[%lld] failed", len), -EACCES); | 773 | + CHK_PRT_RETURN(mrCb->ibMr == NULL, |
| 774 | + hccp_err("rs_drv_exp_mr_reg ibMr is NULL len[%lld] failed, errno:%d", len, errno), -EACCES); | ||
| 778 | } | 775 | } |
| 779 | 776 | ||
| 780 | mrCb->mrInfo.addr = (uintptr_t)addr; | 777 | mrCb->mrInfo.addr = (uintptr_t)addr; |
| @@ -2287,7 +2284,7 @@ static int RsQpConnectAsyncInitPara(struct RsQpConnPara qpConnPara, int fd, stru | |||
| 2287 | 2284 | ||
| 2288 | CHK_PRT_RETURN(qpConnPara.phyId >= RS_MAX_DEV_NUM, hccp_err("param error ! phyId:%u", qpConnPara.phyId), -EINVAL); | 2285 | CHK_PRT_RETURN(qpConnPara.phyId >= RS_MAX_DEV_NUM, hccp_err("param error ! phyId:%u", qpConnPara.phyId), -EINVAL); |
| 2289 | 2286 | ||
| 2290 | - CHK_PRT_RETURN(fd < 0, hccp_err("param error ! fd:%d must be greater than or equal to 0", fd), -EINVAL); | 2287 | + CHK_PRT_RETURN(fd < 0, hccp_err("param error ! fd:%d must be non-negative", fd), -EINVAL); |
| 2291 | 2288 | ||
| 2292 | ret = RsQpn2qpcb(qpConnPara.phyId, qpConnPara.rdevIndex, qpConnPara.qpn, qpCb); | 2289 | ret = RsQpn2qpcb(qpConnPara.phyId, qpConnPara.rdevIndex, qpConnPara.qpn, qpCb); |
| 2293 | CHK_PRT_RETURN(ret, hccp_err("get qpcb failed, qpn %u, ret %d", qpConnPara.qpn, ret), ret); | 2290 | CHK_PRT_RETURN(ret, hccp_err("get qpcb failed, qpn %u, ret %d", qpConnPara.qpn, ret), ret); |
| @@ -109,7 +109,9 @@ HcclResult GroupScheduleMgr::GetCurLocalRank(uint32_t& localRank) | |||
| 109 | } | 109 | } |
| 110 | 110 | ||
| 111 | if (curLocalRank >= this->serverToRankSize_.at(curServerIdx)) { | 111 | if (curLocalRank >= this->serverToRankSize_.at(curServerIdx)) { |
| 112 | - HCCL_ERROR("[getCurLocalRank] is invalid:%u", curLocalRank); | 112 | + HCCL_ERROR( |
| 113 | + "[getCurLocalRank] curLocalRank[%u] is invalid, valid range [0, %u)", curLocalRank, | ||
| 114 | + this->serverToRankSize_.at(curServerIdx)); | ||
| 113 | return HCCL_E_INTERNAL; | 115 | return HCCL_E_INTERNAL; |
| 114 | } | 116 | } |
| 115 | 117 | ||
| @@ -133,7 +133,9 @@ HcclResult ClusterMonitor::GetSocketDescFromRankInfo( | |||
| 133 | CHK_PTR_NULL(rankGraph); | 133 | CHK_PTR_NULL(rankGraph); |
| 134 | CHK_RET(rankGraph->GetDevicePort(remoteRank, &rmtPort)); | 134 | CHK_RET(rankGraph->GetDevicePort(remoteRank, &rmtPort)); |
| 135 | if (rmtPort > Hccl::MAX_VALUE_TCPPORT) { | 135 | if (rmtPort > Hccl::MAX_VALUE_TCPPORT) { |
| 136 | - HCCL_ERROR("[%s] Invalid port[%u] of Rank[%u]", __func__, rmtPort, remoteRank); | 136 | + HCCL_ERROR( |
| 137 | + "[%s] Invalid port[%u] of Rank[%u], max valid port is %u", __func__, rmtPort, remoteRank, | ||
| 138 | + Hccl::MAX_VALUE_TCPPORT); | ||
| 137 | return HCCL_E_PARA; | 139 | return HCCL_E_PARA; |
| 138 | } | 140 | } |
| 139 | CommLink* links = nullptr; | 141 | CommLink* links = nullptr; |
| @@ -161,7 +163,9 @@ HcclResult ClusterMonitor::GetSocketDescFromRankInfo( | |||
| 161 | CHK_RET(rankGraph->GetDevicePort(myRankId, &listenPort)); | 163 | CHK_RET(rankGraph->GetDevicePort(myRankId, &listenPort)); |
| 162 | socketDesc.role = HcommSocketRole::HCOMM_SOCKET_ROLE_SERVER; | 164 | socketDesc.role = HcommSocketRole::HCOMM_SOCKET_ROLE_SERVER; |
| 163 | if (listenPort > Hccl::MAX_VALUE_TCPPORT) { | 165 | if (listenPort > Hccl::MAX_VALUE_TCPPORT) { |
| 164 | - HCCL_ERROR("[%s] Invalid port[%u] of Rank[%u]", __func__, listenPort, myRankId); | 166 | + HCCL_ERROR( |
| 167 | + "[%s] Invalid port[%u] of Rank[%u], max valid port is %u", __func__, listenPort, myRankId, | ||
| 168 | + Hccl::MAX_VALUE_TCPPORT); | ||
| 165 | return HCCL_E_PARA; | 169 | return HCCL_E_PARA; |
| 166 | } | 170 | } |
| 167 | socketDesc.listenPort = static_cast<uint16_t>(listenPort); // socketDesc.port中填监听端口号 | 171 | socketDesc.listenPort = static_cast<uint16_t>(listenPort); // socketDesc.port中填监听端口号 |
| @@ -426,7 +426,9 @@ HcclResult MyRank::QueryListenPort( | |||
| 426 | uint32_t rmtPort = 0; | 426 | uint32_t rmtPort = 0; |
| 427 | CHK_RET(GetDevicePortInternal(remoteRank, &rmtPort, remoteEndpointDesc.loc.locType)); | 427 | CHK_RET(GetDevicePortInternal(remoteRank, &rmtPort, remoteEndpointDesc.loc.locType)); |
| 428 | if (rmtPort > Hccl::MAX_VALUE_TCPPORT) { | 428 | if (rmtPort > Hccl::MAX_VALUE_TCPPORT) { |
| 429 | - HCCL_ERROR("[%s] Invalid port[%u] of Rank[%u]", __func__, rmtPort, remoteRank); | 429 | + HCCL_ERROR( |
| 430 | + "[%s] Invalid port[%u] of Rank[%u], max valid port is %u", __func__, rmtPort, remoteRank, | ||
| 431 | + Hccl::MAX_VALUE_TCPPORT); | ||
| 430 | return HCCL_E_PARA; | 432 | return HCCL_E_PARA; |
| 431 | } | 433 | } |
| 432 | // 查询该socket链接的server端监听的端口(监听方的选择策略需要跟SocketConfig中保持一致) | 434 | // 查询该socket链接的server端监听的端口(监听方的选择策略需要跟SocketConfig中保持一致) |
| @@ -171,7 +171,7 @@ HcclResult CollAllReduceMeshAivExecutor::GetAivExecParam( | |||
| 171 | } | 171 | } |
| 172 | 172 | ||
| 173 | HCCL_INFO( | 173 | HCCL_INFO( |
| 174 | - "SPK, buffersIn [%p] [%p] [%p] [%p] " | 174 | + "[CollAllReduceMeshAivExecutor] buffersIn [%p] [%p] [%p] [%p] " |
| 175 | "buffersOut [%p] [%p] [%p] [%p]", | 175 | "buffersOut [%p] [%p] [%p] [%p]", |
| 176 | args.buffersIn[0], args.buffersIn[1], args.buffersIn[2], args.buffersIn[3], args.buffersOut[0], | 176 | args.buffersIn[0], args.buffersIn[1], args.buffersIn[2], args.buffersIn[3], args.buffersOut[0], |
| 177 | args.buffersOut[1], args.buffersOut[2], args.buffersOut[3]); | 177 | args.buffersOut[1], args.buffersOut[2], args.buffersOut[3]); |
| @@ -183,7 +183,7 @@ HcclResult CollAllReduceMeshAivExecutor::GetAivExecParam( | |||
| 183 | args.reduceOp = param.reduceType; | 183 | args.reduceOp = param.reduceType; |
| 184 | args.devType = static_cast<u32>(topoAttr_.deviceType); | 184 | args.devType = static_cast<u32>(topoAttr_.deviceType); |
| 185 | HCCL_INFO( | 185 | HCCL_INFO( |
| 186 | - "SPK [CollAllReduceMeshAivExecutor][GetAivExecParam], rank[%llu], rankSize[%llu], len[%llu],datatype[%llu], " | 186 | + "[CollAllReduceMeshAivExecutor][GetAivExecParam], rank[%llu], rankSize[%llu], len[%llu],datatype[%llu], " |
| 187 | "op[%llu]", | 187 | "op[%llu]", |
| 188 | args.rank, args.rankSize, args.len, args.dataType, args.reduceOp); | 188 | args.rank, args.rankSize, args.len, args.dataType, args.reduceOp); |
| 189 | 189 | ||
| @@ -2739,17 +2739,17 @@ bool CollCommExecutor::IsLevel0Neighbor(u32 remoteRank, u32 level0RankSize) | |||
| 2739 | 2739 | ||
| 2740 | HcclResult CollCommExecutor::GetAdjInfo(AlgResourceResponse& algRes, AdjInfo& adjInfo) | 2740 | HcclResult CollCommExecutor::GetAdjInfo(AlgResourceResponse& algRes, AdjInfo& adjInfo) |
| 2741 | { | 2741 | { |
| 2742 | - HCCL_INFO("[nslbdp] Entry GetAdjInfo."); | 2742 | + HCCL_INFO("[GetAdjInfo] Entry GetAdjInfo."); |
| 2743 | algResResp_ = &algRes; | 2743 | algResResp_ = &algRes; |
| 2744 | SubCommInfo level1CommInfo = {}; | 2744 | SubCommInfo level1CommInfo = {}; |
| 2745 | AdjInfo nslbAdjInfo = {}; | 2745 | AdjInfo nslbAdjInfo = {}; |
| 2746 | if (Getlevel1CommRank(level1CommInfo) != HCCL_SUCCESS) { | 2746 | if (Getlevel1CommRank(level1CommInfo) != HCCL_SUCCESS) { |
| 2747 | - HCCL_INFO("[nslbdp-GetAdjInfo] Getlevel1CommRank is NULL."); | 2747 | + HCCL_WARNING("[GetAdjInfo] Getlevel1CommRank is NULL."); |
| 2748 | return HCCL_SUCCESS; | 2748 | return HCCL_SUCCESS; |
| 2749 | } | 2749 | } |
| 2750 | u32 localRank = level1CommInfo.localRank; | 2750 | u32 localRank = level1CommInfo.localRank; |
| 2751 | u32 localRankSize = level1CommInfo.localRankSize; | 2751 | u32 localRankSize = level1CommInfo.localRankSize; |
| 2752 | - HCCL_INFO("[nslbdp-GetAdjInfo] level1CommInfo.localRank = [%u] localRankSize = [%u].", localRank, localRankSize); | 2752 | + HCCL_INFO("[GetAdjInfo] level1CommInfo.localRank = [%u] localRankSize = [%u].", localRank, localRankSize); |
| 2753 | 2753 | ||
| 2754 | if (localRankSize == 1) { | 2754 | if (localRankSize == 1) { |
| 2755 | return HCCL_SUCCESS; | 2755 | return HCCL_SUCCESS; |
| @@ -2761,7 +2761,7 @@ HcclResult CollCommExecutor::GetAdjInfo(AlgResourceResponse& algRes, AdjInfo& ad | |||
| 2761 | 2761 | ||
| 2762 | std::unique_ptr<AlgTemplateBase> nslbdp_levelTempAlg; | 2762 | std::unique_ptr<AlgTemplateBase> nslbdp_levelTempAlg; |
| 2763 | if (SelectTempAlg(nslbdp_levelTempAlg, localRankSize) != HCCL_SUCCESS) { | 2763 | if (SelectTempAlg(nslbdp_levelTempAlg, localRankSize) != HCCL_SUCCESS) { |
| 2764 | - HCCL_INFO("[nslbdp-GetAdjInfo] SelectTempAlg is unsuccessful."); | 2764 | + HCCL_WARNING("[GetAdjInfo] SelectTempAlg is unsuccessful."); |
| 2765 | return HCCL_SUCCESS; | 2765 | return HCCL_SUCCESS; |
| 2766 | } | 2766 | } |
| 2767 | if (nslbdp_levelTempAlg == nullptr) { | 2767 | if (nslbdp_levelTempAlg == nullptr) { |
| @@ -2770,7 +2770,7 @@ HcclResult CollCommExecutor::GetAdjInfo(AlgResourceResponse& algRes, AdjInfo& ad | |||
| 2770 | CHK_RET(nslbdp_levelTempAlg->GetNslbAdjInfo(localRank, localRankSize, level1CommInfo.links, nslbAdjInfo)); | 2770 | CHK_RET(nslbdp_levelTempAlg->GetNslbAdjInfo(localRank, localRankSize, level1CommInfo.links, nslbAdjInfo)); |
| 2771 | 2771 | ||
| 2772 | adjInfo.dstRankNum = nslbAdjInfo.dstRankNum; | 2772 | adjInfo.dstRankNum = nslbAdjInfo.dstRankNum; |
| 2773 | - HCCL_INFO("[nslbdp-GetAdjInfo] adjInfo.dstRankNum[%u].", adjInfo.dstRankNum); | 2773 | + HCCL_INFO("[GetAdjInfo] adjInfo.dstRankNum[%u].", adjInfo.dstRankNum); |
| 2774 | 2774 | ||
| 2775 | for (size_t i = 0; i < nslbAdjInfo.nsAdjInfo.size(); i++) { | 2775 | for (size_t i = 0; i < nslbAdjInfo.nsAdjInfo.size(); i++) { |
| 2776 | NslbDpAdjInfo dpAdjInfo = {}; | 2776 | NslbDpAdjInfo dpAdjInfo = {}; |
| @@ -2779,7 +2779,7 @@ HcclResult CollCommExecutor::GetAdjInfo(AlgResourceResponse& algRes, AdjInfo& ad | |||
| 2779 | dpAdjInfo.rev = 0; | 2779 | dpAdjInfo.rev = 0; |
| 2780 | adjInfo.nsAdjInfo.push_back(dpAdjInfo); | 2780 | adjInfo.nsAdjInfo.push_back(dpAdjInfo); |
| 2781 | HCCL_INFO( | 2781 | HCCL_INFO( |
| 2782 | - "[nslbdp]GetAdjInfo dstLocalRankId[%u], phaseId[%u].", nslbAdjInfo.nsAdjInfo[i].dstLocalRankId, | 2782 | + "[GetAdjInfo] dstLocalRankId[%u], phaseId[%u].", nslbAdjInfo.nsAdjInfo[i].dstLocalRankId, |
| 2783 | nslbAdjInfo.nsAdjInfo[i].phaseId); | 2783 | nslbAdjInfo.nsAdjInfo[i].phaseId); |
| 2784 | } | 2784 | } |
| 2785 | return HCCL_SUCCESS; | 2785 | return HCCL_SUCCESS; |
| @@ -146,7 +146,7 @@ HcclResult CollReduceScatterAivDeterSmallExecutor::GetAivExecParam( | |||
| 146 | } | 146 | } |
| 147 | 147 | ||
| 148 | HCCL_INFO( | 148 | HCCL_INFO( |
| 149 | - "SPK, buffersIn [%p] [%p] [%p] [%p] " | 149 | + "[CollReduceScatterAivDeterSmallExecutor] buffersIn [%p] [%p] [%p] [%p] " |
| 150 | "buffersOut [%p] [%p] [%p] [%p]", | 150 | "buffersOut [%p] [%p] [%p] [%p]", |
| 151 | args.buffersIn[0], args.buffersIn[1], args.buffersIn[2], args.buffersIn[3], args.buffersOut[0], | 151 | args.buffersIn[0], args.buffersIn[1], args.buffersIn[2], args.buffersIn[3], args.buffersOut[0], |
| 152 | args.buffersOut[1], args.buffersOut[2], args.buffersOut[3]); | 152 | args.buffersOut[1], args.buffersOut[2], args.buffersOut[3]); |
| @@ -158,7 +158,7 @@ HcclResult CollReduceScatterAivDeterSmallExecutor::GetAivExecParam( | |||
| 158 | args.reduceOp = param.reduceType; | 158 | args.reduceOp = param.reduceType; |
| 159 | args.devType = static_cast<u32>(topoAttr_.deviceType); | 159 | args.devType = static_cast<u32>(topoAttr_.deviceType); |
| 160 | HCCL_INFO( | 160 | HCCL_INFO( |
| 161 | - "SPK [CollReduceScatterAivDeterSmallExecutor][GetAivExecParam], rank[%llu], rankSize[%llu], " | 161 | + "[CollReduceScatterAivDeterSmallExecutor][GetAivExecParam], rank[%llu], rankSize[%llu], " |
| 162 | "len[%llu],datatype[%llu], op[%llu]", | 162 | "len[%llu],datatype[%llu], op[%llu]", |
| 163 | args.rank, args.rankSize, args.len, args.dataType, args.reduceOp); | 163 | args.rank, args.rankSize, args.len, args.dataType, args.reduceOp); |
| 164 | 164 | ||
| @@ -240,7 +240,7 @@ HcclResult CommConfig::SetConfigByVersion(const CommConfigHandle& config) | |||
| 240 | // 版本大于等于11,支持配置通信域级别的sqDepth | 240 | // 版本大于等于11,支持配置通信域级别的sqDepth |
| 241 | sqDepth_ = config.sqDepth; | 241 | sqDepth_ = config.sqDepth; |
| 242 | } | 242 | } |
| 243 | - HCCL_INFO("NSLBDP-VERSION config.info.version = [%u] .", config.info.version); | 243 | + HCCL_INFO("CommConfig version: config.info.version = [%u].", config.info.version); |
| 244 | return HCCL_SUCCESS; | 244 | return HCCL_SUCCESS; |
| 245 | } | 245 | } |
| 246 | 246 | ||
| @@ -333,7 +333,7 @@ HcclResult AicpuZeroCopyExchanger::BatchSetLocalAddrToRemote(void* in, void* out | |||
| 333 | CHK_PRT_RET( | 333 | CHK_PRT_RET( |
| 334 | ret != 0, | 334 | ret != 0, |
| 335 | HCCL_ERROR( | 335 | HCCL_ERROR( |
| 336 | - "[[AicpuZeroCopyExchanger][BatchSetLocalAddrToRemote] Batch get remote " | 336 | + "[AicpuZeroCopyExchanger][BatchSetLocalAddrToRemote] sdma batch copy " |
| 337 | "failed, ret[%u]", | 337 | "failed, ret[%u]", |
| 338 | ret), | 338 | ret), |
| 339 | HCCL_E_INTERNAL); | 339 | HCCL_E_INTERNAL); |
| @@ -368,7 +368,7 @@ HcclResult AicpuZeroCopyExchanger::BatchSetLocalAddrToRemote(void* in, void* out | |||
| 368 | CHK_PRT_RET( | 368 | CHK_PRT_RET( |
| 369 | ret != 0, | 369 | ret != 0, |
| 370 | HCCL_ERROR( | 370 | HCCL_ERROR( |
| 371 | - "[[AicpuZeroCopyExchanger][BatchSetLocalAddrToRemote] Batch get remote " | 371 | + "[AicpuZeroCopyExchanger][BatchSetLocalAddrToRemote] sdma batch copy " |
| 372 | "failed, ret[%u]", | 372 | "failed, ret[%u]", |
| 373 | ret), | 373 | ret), |
| 374 | HCCL_E_INTERNAL); | 374 | HCCL_E_INTERNAL); |
| @@ -326,7 +326,7 @@ HcclResult __hrtGetDevice(s32* deviceLogicId) | |||
| 326 | return HCCL_SUCCESS; | 326 | return HCCL_SUCCESS; |
| 327 | } | 327 | } |
| 328 | *deviceLogicId = 0; | 328 | *deviceLogicId = 0; |
| 329 | - HCCL_WARNING("[hrtGetDevice]Does not support this interface."); | 329 | + HCCL_WARNING("[hrtGetDevice] Does not support this interface."); |
| 330 | return HCCL_E_NOT_SUPPORT; | 330 | return HCCL_E_NOT_SUPPORT; |
| 331 | 331 | ||
| 332 | } | 332 | } |
| @@ -420,10 +420,10 @@ struct TransportDeviceNormalData { | |||
| 420 | "remoteOutputMem: addr[%llu], size[%llu], key[%u]", remoteOutputMem.addr, remoteOutputMem.size, | 420 | "remoteOutputMem: addr[%llu], size[%llu], key[%u]", remoteOutputMem.addr, remoteOutputMem.size, |
| 421 | remoteOutputMem.key); | 421 | remoteOutputMem.key); |
| 422 | HCCL_DEBUG( | 422 | HCCL_DEBUG( |
| 423 | - "remoteInputMem: addr[%llu], size[%llu], key[%u]", localInputMem.addr, localInputMem.size, | 423 | + "localInputMem: addr[%llu], size[%llu], key[%u]", localInputMem.addr, localInputMem.size, |
| 424 | localInputMem.key); | 424 | localInputMem.key); |
| 425 | HCCL_DEBUG( | 425 | HCCL_DEBUG( |
| 426 | - "remoteOutputMem: addr[%llu], size[%llu], key[%u]", localOutputMem.addr, localOutputMem.size, | 426 | + "localOutputMem: addr[%llu], size[%llu], key[%u]", localOutputMem.addr, localOutputMem.size, |
| 427 | localOutputMem.key); | 427 | localOutputMem.key); |
| 428 | HCCL_DEBUG("qpInfo: qpPtr[%llu], sqIndex[%u], dbIndex[%u]", qpInfo.qpPtr, qpInfo.sqIndex, qpInfo.dbIndex); | 428 | HCCL_DEBUG("qpInfo: qpPtr[%llu], sqIndex[%u], dbIndex[%u]", qpInfo.qpPtr, qpInfo.sqIndex, qpInfo.dbIndex); |
| 429 | HCCL_DEBUG("qpMode[%d]", static_cast<int32_t>(qpMode)); | 429 | HCCL_DEBUG("qpMode[%d]", static_cast<int32_t>(qpMode)); |
| @@ -358,7 +358,7 @@ void CcuContextReduceMeshTwoShotMem2Mem1D::BcastLocToRmt( | |||
| 358 | { | 358 | { |
| 359 | CHK_PRT_THROW( | 359 | CHK_PRT_THROW( |
| 360 | dstAddr.size() != transports.size() + 1, | 360 | dstAddr.size() != transports.size() + 1, |
| 361 | - HCCL_ERROR("[ReduceRmtToLoc] srcAddr.size[%zu] != transports size[%zu] + 1", dstAddr.size(), transports.size()), | 361 | + HCCL_ERROR("[ReduceRmtToLoc] dstAddr.size[%zu] != transports size[%zu] + 1", dstAddr.size(), transports.size()), |
| 362 | InvalidParamsException, "Invalid srcAddr size"); | 362 | InvalidParamsException, "Invalid srcAddr size"); |
| 363 | gatherSrc_[rankId_].addr = srcAddr; | 363 | gatherSrc_[rankId_].addr = srcAddr; |
| 364 | gatherSrc_[rankId_].addr += sliceOffset_[rankId_]; | 364 | gatherSrc_[rankId_].addr += sliceOffset_[rankId_]; |
| @@ -73,7 +73,7 @@ HcclResult InsTempReduceAicpuReduce::RunGatherMesh( | |||
| 73 | DataInfo recvData(neighborLinkData, rxSlicesList); | 73 | DataInfo recvData(neighborLinkData, rxSlicesList); |
| 74 | CHK_PRT_RET( | 74 | CHK_PRT_RET( |
| 75 | Recv(recvData, tempInsQues[queIdx], 0, true, dmaMode_), | 75 | Recv(recvData, tempInsQues[queIdx], 0, true, dmaMode_), |
| 76 | - HCCL_ERROR("[InsTempReduceAicpuReduce] BatchSend failed"), HcclResult::HCCL_E_INTERNAL); | 76 | + HCCL_ERROR("[InsTempReduceAicpuReduce] BatchRecv failed"), HcclResult::HCCL_E_INTERNAL); |
| 77 | } | 77 | } |
| 78 | CHK_RET(PostSyncInterQueues(tempInsQues)); | 78 | CHK_RET(PostSyncInterQueues(tempInsQues)); |
| 79 | } else { | 79 | } else { |
| @@ -12,12 +12,12 @@ | |||
| 12 | 12 | ||
| 13 | 13 | ||
| 14 | 14 | ||
| 15 | - | ||
| 16 | 15 | ||
| 17 | 16 | ||
| 18 | 17 | ||
| 19 | 18 | ||
| 20 | 19 | ||
| 20 | + | ||
| 21 | 21 | ||
| 22 | 22 | ||
| 23 | 23 | ||
| @@ -208,3 +208,16 @@ TEST_F(GroupScheduleMgrTest, Ut_pow2Up_When_InputPowerOfTwo_Expect_ReturnSameVal | |||
| 208 | } | 208 | } |
| 209 | EXPECT_EQ(power, expected); | 209 | EXPECT_EQ(power, expected); |
| 210 | } | 210 | } |
| 211 | + | ||
| 212 | +TEST_F(GroupScheduleMgrTest, Ut_GetCurLocalRank_When_RankNotInList_Expect_InternalError) | ||
| 213 | +{ | ||
| 214 | + GroupScheduleMgr mgr; | ||
| 215 | + mgr.userRank_ = 5; | ||
| 216 | + mgr.serverNum_ = 1; | ||
| 217 | + mgr.serverToRankSize_[0] = 2; | ||
| 218 | + mgr.serverToRankList_[0] = {0, 1}; | ||
| 219 | + | ||
| 220 | + uint32_t localRank = 0; | ||
| 221 | + HcclResult ret = mgr.GetCurLocalRank(localRank); | ||
| 222 | + EXPECT_EQ(ret, HCCL_E_INTERNAL); | ||
| 223 | +} | ||
| @@ -20,6 +20,7 @@ | |||
| 20 | 20 | ||
| 21 | 21 | ||
| 22 | 22 | ||
| 23 | + | ||
| 23 | 24 | ||
| 24 | 25 | ||
| 25 | 26 | ||
| @@ -959,6 +960,66 @@ TEST_F(ClusterMonitorTest, Ut_FormatUID_When_NormalInput_Expect_ReturnUid) | |||
| 959 | EXPECT_TRUE(uid.id[0] != '\0'); | 960 | EXPECT_TRUE(uid.id[0] != '\0'); |
| 960 | } | 961 | } |
| 961 | 962 | ||
| 963 | +TEST_F(ClusterMonitorTest, Ut_GetSocketDescFromRankInfo_When_RemotePortInvalid_Expect_ParaError) | ||
| 964 | +{ | ||
| 965 | + auto ctx = CreateHcclCommForInsertTest(); | ||
| 966 | + ASSERT_NE(ctx.hcclCommPtr, nullptr); | ||
| 967 | + HcclComm comm = static_cast<HcclComm>(ctx.hcclCommPtr.get()); | ||
| 968 | + | ||
| 969 | + uint32_t invalidPort = Hccl::MAX_VALUE_TCPPORT + 1; | ||
| 970 | + MOCKER_CPP(&Hccl::IRankGraph::GetDevicePort) | ||
| 971 | + .stubs() | ||
| 972 | + .with(mockcpp::any(), outBoundP(&invalidPort, sizeof(invalidPort))) | ||
| 973 | + .will(returnValue(HCCL_SUCCESS)); | ||
| 974 | + | ||
| 975 | + SocketDesc socketDesc{}; | ||
| 976 | + HcclResult result = g_monitor.GetSocketDescFromRankInfo(comm, 0, 0, ClusterUIDType{}, socketDesc); | ||
| 977 | + EXPECT_EQ(result, HCCL_E_PARA); | ||
| 978 | + | ||
| 979 | + GlobalMockObject::verify(); | ||
| 980 | +} | ||
| 981 | + | ||
| 982 | +// 对端端口正常,本端作为server但监听端口非法时命中 GetSocketDescFromRankInfo 的校验分支 | ||
| 983 | +static HcclResult GetDevicePortStub(Hccl::IRankGraph* self, uint32_t rank, uint32_t* devPort) | ||
| 984 | +{ | ||
| 985 | + // remoteRank=0 返回合法端口,myRankId=1 返回非法端口(触发 listenPort 校验) | ||
| 986 | + *devPort = (rank == 0) ? 10000 : (Hccl::MAX_VALUE_TCPPORT + 1); | ||
| 987 | + return HCCL_SUCCESS; | ||
| 988 | +} | ||
| 989 | + | ||
| 990 | +static HcclResult HcclRankGraphGetLinksDeviceStub( | ||
| 991 | + HcclComm comm, uint32_t netLayer, uint32_t srcRank, uint32_t dstRank, CommLink** links, uint32_t* linkNum) | ||
| 992 | +{ | ||
| 993 | + static CommLink link; | ||
| 994 | + (void)memset_s(&link, sizeof(link), 0, sizeof(link)); | ||
| 995 | + // local(src)地址 < remote(dst)地址,使本端作为server监听 | ||
| 996 | + link.srcEndpointDesc.commAddr.type = CommAddrType::COMM_ADDR_TYPE_IP_V4; | ||
| 997 | + inet_pton(AF_INET, "1.0.0.1", &link.srcEndpointDesc.commAddr.addr); | ||
| 998 | + link.srcEndpointDesc.loc.locType = EndpointLocType::ENDPOINT_LOC_TYPE_DEVICE; | ||
| 999 | + link.dstEndpointDesc.commAddr.type = CommAddrType::COMM_ADDR_TYPE_IP_V4; | ||
| 1000 | + inet_pton(AF_INET, "2.0.0.1", &link.dstEndpointDesc.commAddr.addr); | ||
| 1001 | + link.dstEndpointDesc.loc.locType = EndpointLocType::ENDPOINT_LOC_TYPE_DEVICE; | ||
| 1002 | + *links = &link; | ||
| 1003 | + *linkNum = 1; | ||
| 1004 | + return HCCL_SUCCESS; | ||
| 1005 | +} | ||
| 1006 | + | ||
| 1007 | +TEST_F(ClusterMonitorTest, Ut_GetSocketDescFromRankInfo_When_ListenPortInvalid_Expect_ParaError) | ||
| 1008 | +{ | ||
| 1009 | + auto ctx = CreateHcclCommForInsertTest(); | ||
| 1010 | + ASSERT_NE(ctx.hcclCommPtr, nullptr); | ||
| 1011 | + HcclComm comm = static_cast<HcclComm>(ctx.hcclCommPtr.get()); | ||
| 1012 | + | ||
| 1013 | + MOCKER_CPP(&Hccl::IRankGraph::GetDevicePort).stubs().will(invoke(GetDevicePortStub)); | ||
| 1014 | + MOCKER(HcclRankGraphGetLinks).stubs().will(invoke(HcclRankGraphGetLinksDeviceStub)); | ||
| 1015 | + | ||
| 1016 | + SocketDesc socketDesc{}; | ||
| 1017 | + HcclResult result = g_monitor.GetSocketDescFromRankInfo(comm, 0, 0, ClusterUIDType{}, socketDesc); | ||
| 1018 | + EXPECT_EQ(result, HCCL_E_PARA); | ||
| 1019 | + | ||
| 1020 | + GlobalMockObject::verify(); | ||
| 1021 | +} | ||
| 1022 | + | ||
| 962 | TEST_F(ClusterMonitorTest, Ut_GetUID_When_NormalInput_Expect_ReturnString) | 1023 | TEST_F(ClusterMonitorTest, Ut_GetUID_When_NormalInput_Expect_ReturnString) |
| 963 | { | 1024 | { |
| 964 | std::string netInstId = "testInstance"; | 1025 | std::string netInstId = "testInstance"; |