From 9d904c6d265d1830cee362cf863960d2465cdb8c Mon Sep 17 00:00:00 2001 From: yejianwu Date: Fri, 27 Apr 2018 11:09:31 +0800 Subject: [PATCH] fix report ci for host abi --- tools/mace_tools.py | 15 +++++++++------ tools/sh_commands.py | 19 ++++++++++++------- 2 files changed, 21 insertions(+), 13 deletions(-) diff --git a/tools/mace_tools.py b/tools/mace_tools.py index f06ec24a..879cd72c 100644 --- a/tools/mace_tools.py +++ b/tools/mace_tools.py @@ -121,21 +121,24 @@ def model_benchmark_stdout_processor(stdout, metrics[4] = str(float(parts[5])) break - props = sh_commands.adb_getprop_by_serialno(serialno) - device_type = props.get("ro.product.model", "") - target_soc = props.get("ro.board.platform", "") + device_name = "" + target_soc = "" + if abi != "host": + props = sh_commands.adb_getprop_by_serialno(serialno) + device_name = props.get("ro.product.model", "") + target_soc = props.get("ro.board.platform", "") report_filename = FLAGS.output_dir + "/report.csv" if not os.path.exists(report_filename): with open(report_filename, 'w') as f: - f.write("model_name,device_type,soc,abi,runtime,create_net," + f.write("model_name,device_name,soc,abi,runtime,create_net," "engine_ctor,init,warmup,run_avg\n") - data_str = "{model_name},{device_type},{soc},{abi},{runtime}," \ + data_str = "{model_name},{device_name},{soc},{abi},{runtime}," \ "{create_net},{engine_ctor},{init},{warmup},{run_avg}\n" \ .format( model_name=model_name, - device_type=device_type, + device_name=device_name, soc=target_soc, abi=abi, runtime=runtime, diff --git a/tools/sh_commands.py b/tools/sh_commands.py index 61f49b52..0a2a4f0b 100644 --- a/tools/sh_commands.py +++ b/tools/sh_commands.py @@ -530,8 +530,6 @@ def tuning_run(abi, output_file_name="model_out"): print("* Run '%s' with round=%s, restart_round=%s, tuning=%s" % (model_tag, running_round, restart_round, str(tuning))) - stdout_buff = [] - process_output = make_output_processor(stdout_buff) if abi == "host": p = subprocess.Popen([ "env", @@ -547,8 +545,14 @@ def tuning_run(abi, "--device=%s" % device_type, "--round=%s" % running_round, "--restart_round=%s" % restart_round, - "%s" % option_args]) - p.wait() + "%s" % option_args], + stderr=subprocess.PIPE, + stdout=subprocess.PIPE) + out, err = p.communicate() + stdout = err + out + print stdout + print("Running finished!\n") + return stdout else: sh.adb("-s", serialno, "shell", "mkdir", "-p", phone_data_dir) compiled_opencl_dir = "/data/local/tmp/mace_run/cl_program/" @@ -567,6 +571,8 @@ def tuning_run(abi, adb_push("mace/core/runtime/hexagon/libhexagon_controller.so", phone_data_dir, serialno) + stdout_buff = [] + process_output = make_output_processor(stdout_buff) p = sh.adb( "-s", serialno, @@ -596,9 +602,8 @@ def tuning_run(abi, _bg=True, _err_to_out=True) p.wait() - - print("Running finished!\n") - return "".join(stdout_buff) + print("Running finished!\n") + return "".join(stdout_buff) def validate_model(abi, -- GitLab