---
title: HCCL Test执行时返回“retcode: 7”错误
description: "集群场景下，执行HCCL Test测试命令时，HCCL Test工具已启动成功，但打印出数据量，时间，带宽的表头后，后续执行报错，报错示例如下所示："
url: https://www.hiascend.com/document/detail/zh/canncommercial/latest/devaids/hccltool/HCCLpertest_16_0012.html
sourcePath: /source/zh/canncommercial/900/devaids/hccltool/HCCLpertest_16_0012.html
indexId: 42d7b1eaef550f6b91aa363f6c79c444697b33354e389926b7a65d33360b0e3d71
---
# HCCL Test执行时返回“retcode: 7”错误

#### 问题现象

集群场景下，执行HCCL Test测试命令时，HCCL Test工具已启动成功，但打印出数据量，时间，带宽的表头后，后续执行报错，报错示例如下所示：

```
the minbytes is 8192, maxbytes is 2147483648, iters is 20, warmup_iters is 5
hccl interface return err ./common/src/hccl_test_common.cc:538, retcode: 7 
This is an error in init_hcclComm.
hccl interface return err ./common/src/hccl_test_common.cc:538, retcode: 7 
This is an error in init_hcclComm.
hccl interface return err ./common/src/hccl_test_common.cc:538, retcode: 7 
This is an error in init_hcclComm.
hccl interface return err ./common/src/hccl_test_common.cc:538, retcode: 7 
This is an error in init_hcclComm.
```


#### 可能原因

集群中与当前节点通信的节点上存在未退出的hccl_test进程。


#### 解决方法

利用MPI的能力，终止残余的hccl_test进程。

1. 准备好执行HCCL Test工具时配置的Hostfile文件，即4中所定义的Hostfile文件，例如文件名为“hostfile”。
2. 终止集群中所有节点上参与的hccl_test进程。

  - 安装MPICH的场景，命令示例如下：
mpirun -f hostfile -n 512 pkill -9 -f "all_reduce_test|mpirun"

    - -f：MPICH命令参数，表示Hostfile节点列表文件。
    - -n：MPICH命令参数，表示需要终止的NPU总数，即节点数量*每个节点上参与训练的NPU个数，请根据实际情况修改。
    - pkill：Linux命令，紧跟的“-f”为pkill参数，用于指定要匹配的进程名或命令行参数的模式，其中命令示例中的“all_reduce_test”是之前执行的HCCL测试命令，请根据实际执行的命令进行修改。
  - 安装Open MPI的场景，命令示例如下：
mpirun -hostfile hostfile -n 512 pkill -9 -f "all_reduce_test|openmpi"

    - -hostfile：Open MPI命令参数，表示Hostfile节点列表文件。
    - -n：Open MPI命令参数，表示需要终止的NPU总数，即节点数量*每个节点上参与训练的NPU个数，请根据实际情况修改。
    - pkill：Linux命令，紧跟的“-f”为pkill参数，用于指定要匹配的进程名或命令行参数的模式，其中命令示例中的“all_reduce_test”是之前执行的HCCL测试命令，请根据实际执行的命令进行修改。
3. 以上步骤执行完成后，再次执行HCCL Test工具进行测试即可。
