Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI: Add a --seq flag to run benchmarks sequentially #267

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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
19 changes: 15 additions & 4 deletions utils/run_benchmarks.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,8 @@ def run_all_benchmarks(
skip_csv=False,
skip_main=False,
skip_regression=False,
verbose=False,
seq: bool = False,
verbose: bool = False,
debug: bool = False,
):
logger.info("Running benchmarks", end="", flush=True)
Expand All @@ -282,7 +283,7 @@ def run_all_benchmarks(
debug=debug,
)

if debug:
if debug or seq:
# bypass process pool and call benchmarks directly if --debug is set.
results = [run_a_benchmark(b) for b in benchmarks]
else:
Expand Down Expand Up @@ -348,8 +349,11 @@ def run_all_benchmarks(
debug=debug,
)

with ProcessPoolExecutor(max_workers) as executor:
results_main = list(executor.map(run_a_benchmark, benchmarks))
if debug or seq:
results_main = [run_a_benchmark(b) for b in benchmarks]
else:
with ProcessPoolExecutor(max_workers) as executor:
results_main = list(executor.map(run_a_benchmark, benchmarks))

# Print table with combined results to make comparison easier
trunc = lambda s: s[:10] + "\u2026" if len(s) > 10 else s # noqa
Expand Down Expand Up @@ -464,6 +468,12 @@ def run_all_benchmarks(
default=False,
help="Skip regression testing against main branch",
)
args_parser.add_argument(
"--seq",
action="store_true",
default=False,
help="Run benchmarks sequentially, instead of in parallel",
)
args_parser.add_argument(
"--verbose",
action="store_true",
Expand Down Expand Up @@ -518,6 +528,7 @@ def run_all_benchmarks(
skip_csv=args.skip_csv,
skip_main=args.skip_main,
skip_regression=args.skip_regression,
seq=args.seq,
verbose=args.verbose,
debug=args.debug,
)
Loading