diff --git a/kaprese/bin/kaprese_run.py b/kaprese/bin/kaprese_run.py index 7391f6b..a047de6 100644 --- a/kaprese/bin/kaprese_run.py +++ b/kaprese/bin/kaprese_run.py @@ -301,6 +301,12 @@ def main( help='benchmark to run (see "kaprese benchmark list")', ) + parser.add_argument( + "extra_args", + nargs="*", + help="extra arguments for engine (e.g. -- -j4)", + ) + # Branching to pass type checking args = parser.parse_args(argv, namespace=args) if args else parser.parse_args(argv) @@ -369,7 +375,7 @@ def main( # Start preparing row.prepare_start() - runner = Runner(bench, engine, args.output) + runner = Runner(bench, engine, args.output, args.extra_args) prepared = runner.prepare(force=args.rebuild_runner) row.prepare_done(prepared) if not prepared: diff --git a/kaprese/core/runner.py b/kaprese/core/runner.py index ca1931f..a5ac3c6 100644 --- a/kaprese/core/runner.py +++ b/kaprese/core/runner.py @@ -16,10 +16,17 @@ class Runner: def __init__( - self, benchmark: Benchmark, engine: Engine, output_dir: str | None = None + self, + benchmark: Benchmark, + engine: Engine, + output_dir: str | None = None, + extra_args: str | list[str] = "", ): self.benchmark = benchmark self.engine = engine + self.extra_args = ( + extra_args if isinstance(extra_args, str) else " ".join(extra_args) + ) self.output_dir = Path( f"{output_dir or 'kaprese-out'}/{engine.name}/{benchmark.name}" diff --git a/kaprese/engines/saver.py b/kaprese/engines/saver.py index 5eaa03d..287a8d9 100644 --- a/kaprese/engines/saver.py +++ b/kaprese/engines/saver.py @@ -14,7 +14,7 @@ def register_saver(overwrite: bool = False) -> None: exec_commands=[ "make clean -j$(nproc) >/dev/null", "infer capture -- make -j$(nproc) >/dev/null", - 'infer saver --error-report report.json $([ -e api.json ] && echo \\"--resource-api-spec api.json\\")', + 'infer saver --error-report report.json $([ -e api.json ] && echo \\"--resource-api-spec api.json\\") {runner.extra_args}', "export RETURN_CODE=$?", "cp -r infer-out/* {runner.mount_dir}/", "chown -R {runner.uid}:{runner.gid} {runner.mount_dir}",