run_test.sh 1.68 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
for para in $*
do
    if [[ $para == --testmode* ]];then
        testmode=${para#*=}
    elif [[ $para == --profiling* ]];then
        profiling=${para#*=}
    fi
done

CURRENT_DIR=$( cd "$( dirname "$0" )" && pwd )
echo "CURRENT_DIR = ${CURRENT_DIR}"
TEST_DIR=${CURRENT_DIR}/tests_mpi

LAUNCH_WITH_BINDING=${TEST_DIR}/launch_with_binding.sh # Please adjust the variables based on the actual NET being used
DTK_ENV="/opt/dtk/env.sh" # where env.sh of dtk
TEST_ENV=${TEST_DIR}/test_env.sh


#######################################################################################
# Those variables no need to modify
# HOSTFILE="hostfile_$(basename "$0" | sed -E 's/^run_(.+)\.sh$/\1/')"
HOSTFILE="${TEST_DIR}/hostfile"
GPUS=$(($(cat ${HOSTFILE}|sort|uniq |wc -l) * 8))
HOST="$(cat ${HOSTFILE} |sed -n "1p"|awk -F ' ' '{print $1}')"
PORT="1234"
echo "HOST=${HOST}, PORT=${PORT}, GPUS=${GPUS}"

# Runs aibenchmark model
source ${TEST_ENV}
mpirun -np ${GPUS}  --hostfile ${HOSTFILE} \
                    --allow-run-as-root \
                    bash -c "
                    source ${DTK_ENV} && \
                    source ${TEST_ENV} && \
                    export TEST_DIR=${TEST_DIR} && \
                    ${TEST_DIR}/test_start.sh \
                    ${HOST} \
                    ${PORT} \
                    --launch_with_binding=${LAUNCH_WITH_BINDING} \
                    --testmode=${testmode} \
                    --profiling=${profiling}
                    "
                    #> log-$((${GPUS} / 8))nodes-`date +%F-%H%M`.log 2>&1
wait


## 修改 hostfile,指定测试的模式
# ./run_test.sh --testmode=intranode 
# ./run_test.sh --testmode=internode 
# ./run_test.sh --testmode=lowlatency