diff --git a/benchmarks/auto_benchmark.py b/benchmarks/auto_benchmark.py index a2851fd4f6..08d96bf200 100644 --- a/benchmarks/auto_benchmark.py +++ b/benchmarks/auto_benchmark.py @@ -80,12 +80,6 @@ def report_cmd(self, cmd): self.bm_config["report_cmd"] = " ".join(cmd_options) - def enable_launcher_with_logical_core(self): - if self.bm_config["hardware"] == "cpu": - with open("./benchmarks/config.properties", "a") as f: - f.write("cpu_launcher_enable=true\n") - f.write("cpu_launcher_args=--use_logical_core\n") - def load_config(self): report_cmd = None for k, v in self.yaml_dict.items(): @@ -106,8 +100,6 @@ def load_config(self): else "{}/cpu".format(MODEL_JSON_CONFIG_PATH) ) - self.enable_launcher_with_logical_core() - if self.skip_ts_install: self.bm_config["version"] = get_torchserve_version() @@ -133,6 +125,7 @@ def benchmark_env_setup(bm_config, skip_ts_install): install_torchserve(skip_ts_install, bm_config["hardware"], bm_config["version"]) setup_benchmark_path(bm_config["model_config_path"]) build_model_json_config(bm_config["models"]) + enable_launcher_with_logical_core(bm_config["hardware"]) def install_torchserve(skip_ts_install, hw, ts_version): @@ -186,6 +179,13 @@ def build_model_json_config(models): gen_model_config_json.convert_yaml_to_json(input_file, MODEL_JSON_CONFIG_PATH) +def enable_launcher_with_logical_core(hw): + if hw == "cpu": + with open("./benchmarks/config.properties", "a") as f: + f.write("cpu_launcher_enable=true\n") + f.write("cpu_launcher_args=--use_logical_core\n") + + def run_benchmark(bm_config): files = os.listdir(bm_config["model_config_path"]) files.sort()