文档
注册

准备多机多卡训练

多卡分布式训练场景分为单机多卡训练和多机多卡训练。如果用户准备进行单机多卡训练,请跳过本章节。如果用户要进行多机多卡训练,则需要进行以下准备操作。以下操作除模型修改外,只需配置执行一次。

集合通信仅支持1/2/4/8P粒度的分配。

  1. 准备组网,以两台8卡服务器组网为例。

    通过交换机或光口直连的方式完成计算设备组网搭建。

  2. 配置device IP。
    1. 在AI Server0上配置device IP,以下IP为示例。
         hccn_tool -i 0 -ip -s address 192.***.***.001 netmask 255.255.255.0
         hccn_tool -i 1 -ip -s address 192.***.***.001 netmask 255.255.255.0
         hccn_tool -i 2 -ip -s address 192.***.***.001 netmask 255.255.255.0
         hccn_tool -i 3 -ip -s address 192.***.***.001 netmask 255.255.255.0
         hccn_tool -i 4 -ip -s address 192.***.***.001 netmask 255.255.255.0
         hccn_tool -i 5 -ip -s address 192.***.***.001 netmask 255.255.255.0
         hccn_tool -i 6 -ip -s address 192.***.***.001 netmask 255.255.255.0
         hccn_tool -i 7 -ip -s address 192.***.***.001 netmask 255.255.255.0
    1. 在AI Server1上配置device IP,以下IP为示例。
         hccn_tool -i 0 -ip -s address 192.***.***.002 netmask 255.255.255.0
         hccn_tool -i 1 -ip -s address 192.***.***.002 netmask 255.255.255.0
         hccn_tool -i 2 -ip -s address 192.***.***.002 netmask 255.255.255.0
         hccn_tool -i 3 -ip -s address 192.***.***.002 netmask 255.255.255.0
         hccn_tool -i 4 -ip -s address 192.***.***.002 netmask 255.255.255.0
         hccn_tool -i 5 -ip -s address 192.***.***.002 netmask 255.255.255.0
         hccn_tool -i 6 -ip -s address 192.***.***.002 netmask 255.255.255.0
         hccn_tool -i 7 -ip -s address 192.***.***.002 netmask 255.255.255.0

      配置device IP需遵守以下规则:

      1. AI Server中的第0/4、1/5、2/6、3/7号device需处于同一网段,第0/1/2/3号device在不同网段,第4/5/6/7号device在不同网段。
      2. 对于集群场景,各AI Server对应的位置的device需处于同一网段,AI Server0和AI Server1的0号网卡需处于同一网段、1号网卡需要在同一网段。
      3. 每个IP都不能冲突,相同网段下的IP需在最后8位做区分。
    2. 使用hccn_tool 确保两机器的卡间连通性,从device0 - devcie7 测试8次,确保所有两机间所有卡都连通。
      hccn_tool -i 0 -netdetect -s address xx.xx.xx.xx
      hccn_tool -i 0 -net_health -g 
      #-s address:xx.xx.xx.xx是另外一台机器的device i的IP
      #-i:device序号
    3. 使用hccn_tool工具验证device IP是否配置正确。
      1. 查询每个device的ip:
        hccn_tool -i 0 -ip -g
      2. 打印查询结果:
        ipaddr:192.***.***.001
        netmask:255.255.255.0

        如果返回success则表示已经连通。

  3. 配置防火墙。
    • Ubuntu系统防火墙关闭命令。
      ufw disable
    • Redhat或CentOS 7系统防火墙关闭命令。
      systemctl stop firewalld
  4. 确认交换机状态正常。

    执行以下命令,返回值不为空则正常。

    for i in {0..7}; do hccn_tool -i $i -lldp -g; done
  5. 修改模型。可参考单机多卡模型脚本,将模型脚本上传至AI Server0和AI Server1任意路径下。
  6. 拉起多机多卡训练。需注意以下要点:
    • 在所有脚本统一主节点的MASTER_PORT和MASTER_ADDR。
    • 配置相应的rank与world_size。
  7. 查看host日志。host日志保存在~/ascend/log路径下,用户可以到该路径下查看每个host的device日志。
搜索结果
找到“0”个结果

当前产品无相关内容

未找到相关内容,请尝试其他搜索词