Support SolverBenchmarks#7
Support SolverBenchmarks#7MaxenceGollier wants to merge 60 commits intoJuliaSmoothOptimizers:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Adds support for running solver-style benchmarks from an arbitrary script in the benchmarked repository (rather than being limited to PkgBenchmark.jl suites), and integrates it into JSOBenchmarks.
Changes:
- Introduces
run_solver_benchmarksto execute a user-provided benchmark script on the current branch and a reference branch, then build performance profiles. - Exposes the new functionality from the main module and makes the Markdown report generation tolerate missing/empty sections.
- Adds
LibGit2as a dependency for checking out and running the reference branch script.
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 7 comments.
| File | Description |
|---|---|
src/solver_benchmarks.jl |
New benchmark runner that executes a repo script across branches and builds SolverBenchmark performance profiles. |
src/JSOBenchmarks.jl |
Includes and exports run_solver_benchmarks; makes write_simple_md_report conditional on available content. |
Project.toml |
Adds LibGit2 dependency/compat for branch checkout functionality. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # Run the benchmark script on this commit | ||
| this_commit = Base.include(Main, joinpath(bmark_dir, script)) | ||
| @assert this_commit isa Dict{Symbol, DataFrame} "Expected the benchmark script to return a Dict{Symbol, DataFrame}, but got $(typeof(this_commit)). Make sure your benchmark script returns a dict resulting from BenchmarkSolver.bmark_solver function" | ||
|
|
||
| # Run the benchmark script on the reference branch | ||
| local reference | ||
| if is_git | ||
| repo_dir = joinpath(bmark_dir, "..") | ||
| repo = LibGit2.GitRepo(repo_dir) | ||
| println("repo_dir : $repo_dir") | ||
| println("bmark_dir : $bmark_dir") | ||
| reference = _withcommit(joinpath(bmark_dir, script), repo, reference_branch) | ||
| end |
There was a problem hiding this comment.
The reference-branch run is done by checkout!-ing and then Base.include(Main, script) in the same Julia process. If the script does using <PackageBeingBenchmarked>, Julia will not reload the module after the checkout, so the “reference” benchmarks can accidentally run against the already-loaded current-branch code. To ensure correct comparisons, run each branch/commit’s script in a fresh Julia process (or load into isolated modules/processes and explicitly restart the session between runs) and deserialize the returned results.
There was a problem hiding this comment.
I think this is fine, it looks like this is how they do it in PkgBenchmarks.jl
|
The code is messy, it rewrites a lot of stuff from Maybe we should update/clean both codes in a separate PR ? I agree that merging my messy code is not ideal but i have at least a proof of concept in RegularizedOptimization. Both my function and What do you think @dpo ? |
Hi @tmigot, @dpo.
I added a function
run_solver_benchmarksthat allows to make a run with, for example,SolverBenchmarks.How does it work ?
Instead of being limited to the benchmark suits from
PkgBenchmark.jl, this function executes a specifiedscriptfrom the repository being benchmarked on the current branch and on a specifiedtarget_branch.This benchmark script can do whatever the user likes but should currently return a
Dictlike those returned frombmark_solvers.The function then proceeds to construct performance profiles.
Example use:
In
RegularizedOptimization.jli wrote a simple benchmark script asWe also added a workflow that runs on PRs:
I opened a PR where i add a bad modification to R2: JuliaSmoothOptimizers/RegularizedOptimization.jl#309.
This gave the following gist:
https://gist.github.com/dpo/bfe8576c5f8e93940a57007513aebb0f
This is mostly a proof of concept and I am open to your suggestions on what we could add to the function to make it more flexible!
Thank you.