export MASTER_ADDR=127.0.0.1 export MASTER_PORT=63350 export HCCL_WHITELIST_DISABLE=1 NPUS=($(seq 0 7)) export NPU_WORLD_SIZE=${#NPUS[@]} rank=0 for i in ${NPUS[@]} do export NPU_CALCULATE_DEVICE=${i} export RANK=${rank} echo run process ${rank} please input your shell script here > output_npu_${i}.log 2>&1 & let rank++ done
参数 |
说明 |
---|---|
MASTER_ADDR |
指定训练服务器的ip |
MASTER_PORT |
指定训练服务器的端口 |
HCCL_WHITELIST_DISABLE |
hccl后端环境 |
NPUS |
指定在特定NPU上运行 |
NPU_WORLD_SIZE |
NPU核心数量 |
RANK |
进程号 |
在执行转换后的模型之前需要把run_distributed_npu.sh文件中的“please input your shell script here”语句替换成模型原来的训练shell脚本。执行run_distributed_npu.sh文件后会生成指定NPU的log日志。