#!/bin/bash

export NCCL_TOPO_FILE=null
export NCCL_ALGO=Ring
export NCCL_RINGS="N0 0 7 6 5 4 3 2 1 N0|N1 1 2 3 4 5 6 7 0 N1|N2 2 1 0 7 6 5 4 3 N2|N3 3 4 5 6 7 0 1 2 N3|N4 4 3 2 1 0 7 6 5 N4|N5 5 6 7 0 1 2 3 4 N5|N6 6 5 4 3 2 1 0 7 N6|N7 7 0 1 2 3 4 5 6 N7"

export PYTORCH_MIOPEN_SUGGEST_NHWC=1
export MIOPEN_PRECISION_FP32_FP32_FP32_TF32_FP32=1
export MIOPEN_FIND_MODE=1
export ROCBLAS_MATH_MODE=1
export HSA_FORCE_FINE_GRAIN_PCIE=1

export TORCHINDUCTOR_LAYOUT_OPTIMIZATION=1
export TORCHINDUCTOR_COORDINATE_DESCENT_TUNING=1

#export MIOPEN_ENABLE_LOGGING=1        # 打开MIOPEN  LOGGING日志 default =0
#export MIOPEN_ENABLE_LOGGING_CMD=1    # 输出日志CMD信息 default =0
#export MIOPEN_LOG_LEVEL=6             # 设置日志打印level default=0
#export ROCBLAS_LAYER=3                # 打开 rocblas输出日志 default=0





TIME=$(date "+%Y-%m-%d_%H_%M")

MASTER_ADDR=${1:-localhost}
NNODES=${2:-1}
NODE_RANK=${3:-0}
CONFIG=${4:-projects/configs/flashocc/flashocc-r50.py}

bash tools/dist_train_numa.sh $MASTER_ADDR $NNODES $NODE_RANK $CONFIG \
	2>&1 | tee cvm_bw1000_flashocc_${NNODES}nodes_$TIME.log
