Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions choose_best_layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ def parse_args() -> argparse.Namespace:
required=True,
help="Number of leaves in the tree.",
)
p.add_argument(
"--print-cmd",
action="store_true",
help="Print the app.py command for each fanout.",
)

p.add_argument(
"--style",
choices=["aztec", "zama", "soundness"],
Expand Down Expand Up @@ -64,7 +70,7 @@ def parse_args() -> argparse.Namespace:
return p.parse_args()


def run_app(app_path: Path, leaves: int, style: str, fanout: int) -> Dict[str, Any]:
def run_app(app_path: Path, leaves: int, style: str, fanout: int, print_cmd: bool = False) -> Dict[str, Any]:
cmd = [
sys.executable,
str(app_path),
Expand All @@ -75,6 +81,9 @@ def run_app(app_path: Path, leaves: int, style: str, fanout: int) -> Dict[str, A
str(fanout),
"--json",
]
if print_cmd:
print(">>", " ".join(cmd), file=sys.stderr)

result = subprocess.run(
cmd,
text=True,
Expand Down Expand Up @@ -118,7 +127,7 @@ def main() -> None:

for f in args.fanouts:
try:
data = run_app(app_path, args.leaves, args.style, f)
data = run_app(app_path, args.leaves, args.style, f, print_cmd=args.print_cmd)
layouts.append(LayoutResult(fanout=f, data=data))
except Exception as e: # noqa: BLE001
print(f"ERROR for fanout={f}: {e}", file=sys.stderr)
Expand Down