提交 4937a2ef 编写于 作者: 李寅

Add stress (restart) test

上级 f6ccc534
...@@ -80,9 +80,9 @@ def build_mace_run(production_mode, model_output_dir, hexagon_mode): ...@@ -80,9 +80,9 @@ def build_mace_run(production_mode, model_output_dir, hexagon_mode):
run_command(command) run_command(command)
def tuning_run(model_output_dir, running_round, tuning, production_mode): def tuning_run(model_output_dir, running_round, tuning, production_mode, restart_round):
command = "bash tools/tuning_run.sh {} {} {} {}".format( command = "bash tools/tuning_run.sh {} {} {} {} {}".format(
model_output_dir, running_round, int(tuning), int(production_mode)) model_output_dir, running_round, int(tuning), int(production_mode), restart_round)
run_command(command) run_command(command)
...@@ -91,8 +91,8 @@ def benchmark_model(model_output_dir): ...@@ -91,8 +91,8 @@ def benchmark_model(model_output_dir):
run_command(command) run_command(command)
def run_model(model_output_dir, running_round): def run_model(model_output_dir, running_round, restart_round):
tuning_run(model_output_dir, running_round, False, False) tuning_run(model_output_dir, running_round, False, False, restart_round)
def generate_production_code(model_output_dirs, pull_or_not): def generate_production_code(model_output_dirs, pull_or_not):
...@@ -117,7 +117,8 @@ def build_mace_run_prod(model_output_dir, tuning, libmace_name): ...@@ -117,7 +117,8 @@ def build_mace_run_prod(model_output_dir, tuning, libmace_name):
model_output_dir, model_output_dir,
running_round=0, running_round=0,
tuning=tuning, tuning=tuning,
production_mode=production_or_not) production_mode=production_or_not,
restart_round=1)
production_or_not = True production_or_not = True
pull_or_not = True pull_or_not = True
...@@ -175,6 +176,8 @@ def parse_args(): ...@@ -175,6 +176,8 @@ def parse_args():
"--round", type=int, default=1, help="The model running round.") "--round", type=int, default=1, help="The model running round.")
parser.add_argument("--run_seconds", type=int, default=10, parser.add_argument("--run_seconds", type=int, default=10,
help="The model throughput test running seconds.") help="The model throughput test running seconds.")
parser.add_argument(
"--restart_round", type=int, default=1, help="The model restart round.")
parser.add_argument( parser.add_argument(
"--tuning", type="bool", default="true", help="Tune opencl params.") "--tuning", type="bool", default="true", help="Tune opencl params.")
parser.add_argument("--mode", type=str, default="all", parser.add_argument("--mode", type=str, default="all",
...@@ -194,6 +197,7 @@ def main(unused_args): ...@@ -194,6 +197,7 @@ def main(unused_args):
if FLAGS.mode == "validate": if FLAGS.mode == "validate":
FLAGS.round = 1 FLAGS.round = 1
FLAGS.restart_round = 1
# target_abi = configs["target_abi"] # target_abi = configs["target_abi"]
# libmace_name = get_libs(target_abi, configs) # libmace_name = get_libs(target_abi, configs)
...@@ -252,7 +256,7 @@ def main(unused_args): ...@@ -252,7 +256,7 @@ def main(unused_args):
build_mace_run_prod(model_output_dir, FLAGS.tuning, libmace_name) build_mace_run_prod(model_output_dir, FLAGS.tuning, libmace_name)
if FLAGS.mode == "run" or FLAGS.mode == "validate" or FLAGS.mode == "all": if FLAGS.mode == "run" or FLAGS.mode == "validate" or FLAGS.mode == "all":
run_model(model_output_dir, FLAGS.round) run_model(model_output_dir, FLAGS.round, FLAGS.restart_round)
if FLAGS.mode == "benchmark": if FLAGS.mode == "benchmark":
benchmark_model(model_output_dir) benchmark_model(model_output_dir)
......
...@@ -16,6 +16,7 @@ MODEL_OUTPUT_DIR=$1 ...@@ -16,6 +16,7 @@ MODEL_OUTPUT_DIR=$1
ROUND=$2 ROUND=$2
TUNING_OR_NOT=$3 TUNING_OR_NOT=$3
PRODUCTION_MODE=$4 PRODUCTION_MODE=$4
RESTART_ROUND=$5
if [ x"$TARGET_ABI" = x"host" ]; then if [ x"$TARGET_ABI" = x"host" ]; then
MACE_CPP_MIN_VLOG_LEVEL=$VLOG_LEVEL \ MACE_CPP_MIN_VLOG_LEVEL=$VLOG_LEVEL \
...@@ -28,7 +29,8 @@ if [ x"$TARGET_ABI" = x"host" ]; then ...@@ -28,7 +29,8 @@ if [ x"$TARGET_ABI" = x"host" ]; then
--output_file=${MODEL_OUTPUT_DIR}/${OUTPUT_FILE_NAME} \ --output_file=${MODEL_OUTPUT_DIR}/${OUTPUT_FILE_NAME} \
--model_data_file=${MODEL_OUTPUT_DIR}/${MODEL_TAG}.data \ --model_data_file=${MODEL_OUTPUT_DIR}/${MODEL_TAG}.data \
--device=${DEVICE_TYPE} \ --device=${DEVICE_TYPE} \
--round=1 || exit 1 --round=1 \
--restart_round=1 || exit 1
else else
if [[ "${TUNING_OR_NOT}" != "0" && "$PRODUCTION_MODE" != 1 ]];then if [[ "${TUNING_OR_NOT}" != "0" && "$PRODUCTION_MODE" != 1 ]];then
tuning_flag=1 tuning_flag=1
...@@ -69,7 +71,8 @@ else ...@@ -69,7 +71,8 @@ else
--output_file=${PHONE_DATA_DIR}/${OUTPUT_FILE_NAME} \ --output_file=${PHONE_DATA_DIR}/${OUTPUT_FILE_NAME} \
--model_data_file=${PHONE_DATA_DIR}/${MODEL_TAG}.data \ --model_data_file=${PHONE_DATA_DIR}/${MODEL_TAG}.data \
--device=${DEVICE_TYPE} \ --device=${DEVICE_TYPE} \
--round=$ROUND; echo \\$?"` || exit 1 --round=$ROUND \
--restart_round=$RESTART_ROUND; echo \\$?"` || exit 1
echo "$mace_adb_output" | head -n -1 echo "$mace_adb_output" | head -n -1
mace_adb_return_code=`echo "$mace_adb_output" | tail -1` mace_adb_return_code=`echo "$mace_adb_output" | tail -1`
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册