From 34d8dd90e14f70c7189f11fb0aef89f68fc8658c Mon Sep 17 00:00:00 2001 From: Vitor Bandeira Date: Mon, 25 Aug 2025 19:12:27 +0000 Subject: [PATCH 1/5] at: add arg to set memory limit For reference, nangate45/gcd uses about ~3GB Signed-off-by: Vitor Bandeira --- tools/AutoTuner/src/autotuner/distributed.py | 7 +++++++ tools/AutoTuner/src/autotuner/utils.py | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/tools/AutoTuner/src/autotuner/distributed.py b/tools/AutoTuner/src/autotuner/distributed.py index 2d87b710ac..42fc5ec0aa 100644 --- a/tools/AutoTuner/src/autotuner/distributed.py +++ b/tools/AutoTuner/src/autotuner/distributed.py @@ -380,6 +380,13 @@ def parse_arguments(): default=42, help="Random seed. (0 means no seed.)", ) + tune_parser.add_argument( + "--memory_limit", + type=float, + metavar="", + default=1, + help="Maximum memory in GB that each trial job can use, process will be killed and not retried if it exceeds.", + ) # Workload parser.add_argument( diff --git a/tools/AutoTuner/src/autotuner/utils.py b/tools/AutoTuner/src/autotuner/utils.py index 3b49c32110..fb5efa94f9 100644 --- a/tools/AutoTuner/src/autotuner/utils.py +++ b/tools/AutoTuner/src/autotuner/utils.py @@ -324,7 +324,7 @@ def openroad( export_command += " && " make_command = export_command - make_command += f"make -C {base_dir}/flow DESIGN_CONFIG=designs/" + make_command += f"ulimit -v {args.memory_limit * 1_000_000}; make -C {base_dir}/flow DESIGN_CONFIG=designs/" make_command += f"{args.platform}/{args.design}/config.mk" make_command += f" PLATFORM={args.platform}" make_command += f" FLOW_VARIANT={flow_variant} {parameters}" From 52b1f22424cca5054491a303a1664d804dce94fb Mon Sep 17 00:00:00 2001 From: Vitor Bandeira Date: Mon, 25 Aug 2025 19:34:20 +0000 Subject: [PATCH 2/5] at: memory limit disabled by default Signed-off-by: Vitor Bandeira --- tools/AutoTuner/src/autotuner/distributed.py | 2 +- tools/AutoTuner/src/autotuner/utils.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/AutoTuner/src/autotuner/distributed.py b/tools/AutoTuner/src/autotuner/distributed.py index 42fc5ec0aa..d1b2f9fd56 100644 --- a/tools/AutoTuner/src/autotuner/distributed.py +++ b/tools/AutoTuner/src/autotuner/distributed.py @@ -384,7 +384,7 @@ def parse_arguments(): "--memory_limit", type=float, metavar="", - default=1, + default=None, help="Maximum memory in GB that each trial job can use, process will be killed and not retried if it exceeds.", ) diff --git a/tools/AutoTuner/src/autotuner/utils.py b/tools/AutoTuner/src/autotuner/utils.py index fb5efa94f9..34197592e2 100644 --- a/tools/AutoTuner/src/autotuner/utils.py +++ b/tools/AutoTuner/src/autotuner/utils.py @@ -324,7 +324,9 @@ def openroad( export_command += " && " make_command = export_command - make_command += f"ulimit -v {args.memory_limit * 1_000_000}; make -C {base_dir}/flow DESIGN_CONFIG=designs/" + if args.memory_limit is not None: + make_command += f"ulimit -m {args.memory_limit * 1_000_000}; " + 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}" make_command += f" FLOW_VARIANT={flow_variant} {parameters}" From 5a2c730549d5bf05cb74d2582ca7d41ddcec4c78 Mon Sep 17 00:00:00 2001 From: Vitor Bandeira Date: Mon, 25 Aug 2025 23:48:57 +0000 Subject: [PATCH 3/5] at: use correct ulimit flag for virtual memory Signed-off-by: Vitor Bandeira --- tools/AutoTuner/src/autotuner/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/AutoTuner/src/autotuner/utils.py b/tools/AutoTuner/src/autotuner/utils.py index 34197592e2..ed5c23df6f 100644 --- a/tools/AutoTuner/src/autotuner/utils.py +++ b/tools/AutoTuner/src/autotuner/utils.py @@ -325,7 +325,7 @@ def openroad( make_command = export_command if args.memory_limit is not None: - make_command += f"ulimit -m {args.memory_limit * 1_000_000}; " + make_command += f"ulimit -v {args.memory_limit * 1_000_000}; " 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}" From 68564efd5e4a1be4fd4a5e3d1d151012b40c1b13 Mon Sep 17 00:00:00 2001 From: Vitor Bandeira Date: Tue, 26 Aug 2025 11:15:26 +0000 Subject: [PATCH 4/5] at: cast to int memory limit, ulimit does not parse floats Signed-off-by: Vitor Bandeira --- tools/AutoTuner/src/autotuner/utils.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/AutoTuner/src/autotuner/utils.py b/tools/AutoTuner/src/autotuner/utils.py index ed5c23df6f..fadab40325 100644 --- a/tools/AutoTuner/src/autotuner/utils.py +++ b/tools/AutoTuner/src/autotuner/utils.py @@ -325,7 +325,8 @@ def openroad( make_command = export_command if args.memory_limit is not None: - make_command += f"ulimit -v {args.memory_limit * 1_000_000}; " + 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}" From d0e0f6d4492cf7e6ee67be8fcb8ef4f3531777d6 Mon Sep 17 00:00:00 2001 From: Vitor Bandeira Date: Thu, 11 Sep 2025 13:27:47 +0000 Subject: [PATCH 5/5] at: move memory_limit arg to be for both modes Signed-off-by: Vitor Bandeira --- tools/AutoTuner/src/autotuner/distributed.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tools/AutoTuner/src/autotuner/distributed.py b/tools/AutoTuner/src/autotuner/distributed.py index d1b2f9fd56..c5b07dc74c 100644 --- a/tools/AutoTuner/src/autotuner/distributed.py +++ b/tools/AutoTuner/src/autotuner/distributed.py @@ -380,13 +380,6 @@ def parse_arguments(): default=42, help="Random seed. (0 means no seed.)", ) - tune_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.", - ) # Workload parser.add_argument( @@ -403,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,