diff --git a/tools/AutoTuner/src/autotuner/distributed.py b/tools/AutoTuner/src/autotuner/distributed.py index 2d87b710ac..c5b07dc74c 100644 --- a/tools/AutoTuner/src/autotuner/distributed.py +++ b/tools/AutoTuner/src/autotuner/distributed.py @@ -396,6 +396,13 @@ def parse_arguments(): default=16, help="Max number of threads openroad can use.", ) + parser.add_argument( + "--memory_limit", + type=float, + metavar="", + default=None, + help="Maximum memory in GB that each trial job can use, process will be killed and not retried if it exceeds.", + ) parser.add_argument( "--server", type=str, diff --git a/tools/AutoTuner/src/autotuner/utils.py b/tools/AutoTuner/src/autotuner/utils.py index 3b49c32110..fadab40325 100644 --- a/tools/AutoTuner/src/autotuner/utils.py +++ b/tools/AutoTuner/src/autotuner/utils.py @@ -324,6 +324,9 @@ def openroad( export_command += " && " make_command = export_command + if args.memory_limit is not None: + limit = int(args.memory_limit * 1_000_000) + make_command += f"ulimit -v {limit}; " make_command += f"make -C {base_dir}/flow DESIGN_CONFIG=designs/" make_command += f"{args.platform}/{args.design}/config.mk" make_command += f" PLATFORM={args.platform}"