# MindSpore并行策略下hccl\_tools工具使用报错

**1. 系统环境**

硬件环境\(Ascend/GPU/CPU\): Ascend

软件环境: MindSpore 版本: 2.1

执行模式： 不限

**2. 报错信息**

2.1 问题描述

并行策略下使用hccl\_tools工具，报错信息如下。

2.2 报错信息

```
[root@localhos t 1_wizardcoder-mindformersl# cd research/
[root@localhost researchl# python ../mindformers/tools/hccl_tools.py --device_num "[0,8)"
start ../mindformers/tools/hccl_tools.py
visible_devices:['0', '1', '2',T13', '4, 15', 16', 17,]
server_id:127.0.0.1
device num_list: [0, 1, 2, 3, 4, 5, 6, 7]
Command execute failed!
Failed to call hccn_tool, try to read /etc/hccn.conf instead
Traceback (most recent cal l last):
    File "../mindformers/tools/hccl_tools.py", line 167, in <module>
        main()
    File "../mindformers/tools /hccl_tools.py", line 137, in main
        device_ip = device_ipsldevice idl
KeyError: '0'
```

**3. 根因分析**

这是因为/etc/hccn.conf文件不存在，需要创建此文件。

**4. 解决方案**

```
/etc/hccn.conf文件不存在，创建此文件。
[root@localhost researchl# vi /etc/hccn.conf
[root@localhost research]# hccn_tool -i 0 -ip -s address 90.90.92. 101 netmask 255.255.255.0
[root@localhost researchl# cat letc/hccn.conf

address_ 0=90.90.92.101
netmask 0=255.255.255.0
[root@localhost research]# hccn_tool -i 1 -ip -s address 90.90.93.101 netmask 255.255.255.0
[root@localhost research]# hccn_tool -i 2 -ip -s address 90.90.94.101 netmask 255.255.255.0
[root@localhost research]# hccn_tool -i 3 -ip -s address 90.90.94.101 netmask 255.255.255.0
[root@localhost research]# hccn_tool -i 4 -ip -s address 90.90.94.101 netmask 255.255.255.0
[root@localhost research]# hccn_tool -i 5 -ip -s address 90.90.94.101 netmask 255.255.255.0
[root@localhost research]# hccn_tool -i 6 -ip -s address 90.90.94.101 netmask 255.255.255.0
[root@localhost research]# hccn_tool -i 7 -ip -s address 90.90.94.101 netmask 255.255.255.0
[root@localhost research]# cat /etc/hccn.conf
```

