-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf: setup more detailed benchmarking
- Loading branch information
Showing
4 changed files
with
112 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,76 +1,120 @@ | ||
name: Benchmark a pull request | ||
name: Benchmarks | ||
permissions: | ||
contents: write # contents permission to update benchmark contents in gh-pages branch | ||
statuses: read | ||
deployments: write # deployments permission to deploy GitHub pages website | ||
pull-requests: write | ||
|
||
on: | ||
pull_request: | ||
|
||
permissions: | ||
pull-requests: write | ||
branches: | ||
- main | ||
paths: | ||
- "src/**/*" | ||
- "ext/**/*" | ||
- "benchmarks/**/*" | ||
- ".buildkite/**/*" | ||
- "Project.toml" | ||
- ".github/workflows/benchmark_pr.yml" | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
generate_plots: | ||
runs-on: ubuntu-latest | ||
benchmark: | ||
if: ${{ !contains(github.event.head_commit.message, '[skip benchmarks]') }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Download Buildkite Artifacts | ||
id: download | ||
uses: EnricoMi/download-buildkite-artifact-action@v1 | ||
with: | ||
buildkite_token: ${{ secrets.BUILDKITE_TOKEN }} | ||
output_path: artifacts | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: julia-actions/setup-julia@v2 | ||
with: | ||
version: "1" | ||
- uses: julia-actions/cache@v2 | ||
- name: Extract Package Name from Project.toml | ||
id: extract-package-name | ||
run: | | ||
PACKAGE_NAME=$(grep "^name" Project.toml | sed 's/^name = "\(.*\)"$/\1/') | ||
echo "::set-output name=package_name::$PACKAGE_NAME" | ||
- name: Build AirspeedVelocity | ||
env: | ||
JULIA_NUM_THREADS: 2 | ||
run: | | ||
# Lightweight build step, as sometimes the runner runs out of memory: | ||
julia -e 'ENV["JULIA_PKG_PRECOMPILE_AUTO"]=0; import Pkg; Pkg.add("AirspeedVelocity")' | ||
julia -e 'ENV["JULIA_PKG_PRECOMPILE_AUTO"]=0; import Pkg; Pkg.build("AirspeedVelocity")' | ||
- name: Add ~/.julia/bin to PATH | ||
run: | | ||
echo "$HOME/.julia/bin" >> $GITHUB_PATH | ||
- name: Run benchmarks | ||
run: | | ||
echo $PATH | ||
ls -l ~/.julia/bin | ||
mkdir results | ||
benchpkg ${{ steps.extract-package-name.outputs.package_name }} --rev="${{github.event.repository.default_branch}},${{github.event.pull_request.head.sha}}" --url=${{ github.event.repository.clone_url }} --bench-on="${{github.event.repository.default_branch}}" --output-dir=results/ --tune --add Enzyme | ||
- name: Create plots from benchmarks | ||
run: | | ||
mkdir -p plots | ||
benchpkgplot ${{ steps.extract-package-name.outputs.package_name }} --rev="${{github.event.repository.default_branch}},${{github.event.pull_request.head.sha}}" --npart=10 --format=png --input-dir=results/ --output-dir=plots/ | ||
- name: Upload plot as artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: plots | ||
path: plots | ||
- name: Create markdown table from benchmarks | ||
run: | | ||
benchpkgtable ${{ steps.extract-package-name.outputs.package_name }} --rev="${{github.event.repository.default_branch}},${{github.event.pull_request.head.sha}}" --input-dir=results/ --ratio > table.md | ||
echo '### Benchmark Results' > body.md | ||
echo '' >> body.md | ||
echo '' >> body.md | ||
cat table.md >> body.md | ||
echo '' >> body.md | ||
echo '' >> body.md | ||
echo '### Benchmark Plots' >> body.md | ||
echo 'A plot of the benchmark results have been uploaded as an artifact to the workflow run for this PR.' >> body.md | ||
echo 'Go to "Actions"->"Benchmark a pull request"->[the most recent run]->"Artifacts" (at the bottom).' >> body.md | ||
- name: Locate Benchmarks Artifact | ||
id: locate | ||
if: ${{ steps.download.outputs.download-state == 'success' }} | ||
run: echo "path=$(find artifacts -type f -name combinedbenchmarks.json 2>/dev/null)" >> $GITHUB_OUTPUT | ||
|
||
- name: Find Comment | ||
uses: peter-evans/find-comment@v3 | ||
id: fcbenchmark | ||
with: | ||
issue-number: ${{ github.event.pull_request.number }} | ||
comment-author: 'github-actions[bot]' | ||
body-includes: Benchmark Results | ||
- name: Upload Benchmark Results | ||
if: ${{ steps.locate.outputs.path != '' }} | ||
uses: benchmark-action/github-action-benchmark@v1 | ||
with: | ||
name: Reactant Benchmarks | ||
tool: "julia" | ||
output-file-path: ${{ steps.locate.outputs.path }} | ||
benchmark-data-dir-path: "benchmarks" | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
comment-always: true | ||
summary-always: true | ||
alert-threshold: "150%" | ||
fail-on-alert: false | ||
auto-push: ${{ github.event_name != 'pull_request' }} | ||
|
||
- name: Comment on PR | ||
uses: peter-evans/create-or-update-comment@v4 | ||
with: | ||
comment-id: ${{ steps.fcbenchmark.outputs.comment-id }} | ||
issue-number: ${{ github.event.pull_request.number }} | ||
body-path: body.md | ||
edit-mode: replace | ||
airspeed-velocity: | ||
runs-on: ubuntu-latest | ||
if: ${{ github.base_ref == github.event.repository.default_branch }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: julia-actions/setup-julia@v2 | ||
with: | ||
version: "1" | ||
- uses: julia-actions/cache@v2 | ||
- name: Extract Package Name from Project.toml | ||
id: extract-package-name | ||
run: | | ||
PACKAGE_NAME=$(grep "^name" Project.toml | sed 's/^name = "\(.*\)"$/\1/') | ||
echo "::set-output name=package_name::$PACKAGE_NAME" | ||
- name: Build AirspeedVelocity | ||
env: | ||
JULIA_NUM_THREADS: 2 | ||
run: | | ||
# Lightweight build step, as sometimes the runner runs out of memory: | ||
julia -e 'ENV["JULIA_PKG_PRECOMPILE_AUTO"]=0; import Pkg; Pkg.add("AirspeedVelocity")' | ||
julia -e 'ENV["JULIA_PKG_PRECOMPILE_AUTO"]=0; import Pkg; Pkg.build("AirspeedVelocity")' | ||
- name: Add ~/.julia/bin to PATH | ||
run: | | ||
echo "$HOME/.julia/bin" >> $GITHUB_PATH | ||
- name: Run benchmarks | ||
run: | | ||
echo $PATH | ||
ls -l ~/.julia/bin | ||
mkdir results | ||
benchpkg ${{ steps.extract-package-name.outputs.package_name }} --rev="${{github.event.repository.default_branch}},${{github.event.pull_request.head.sha}}" -s "benchmarks/asv.jl" --url=${{ github.event.repository.clone_url }} --bench-on="${{github.event.repository.default_branch}}" --output-dir=results/ --tune | ||
- name: Create plots from benchmarks | ||
run: | | ||
mkdir -p plots | ||
benchpkgplot ${{ steps.extract-package-name.outputs.package_name }} --rev="${{github.event.repository.default_branch}},${{github.event.pull_request.head.sha}}" --npart=10 --format=png --input-dir=results/ --output-dir=plots/ | ||
- name: Upload plot as artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: plots | ||
path: plots | ||
- name: Create markdown table from benchmarks | ||
run: | | ||
benchpkgtable ${{ steps.extract-package-name.outputs.package_name }} --rev="${{github.event.repository.default_branch}},${{github.event.pull_request.head.sha}}" --input-dir=results/ --ratio > table.md | ||
echo '### Benchmark Results (ASV)' > body.md | ||
echo '' >> body.md | ||
echo '' >> body.md | ||
cat table.md >> body.md | ||
echo '' >> body.md | ||
echo '' >> body.md | ||
echo '### Benchmark Plots' >> body.md | ||
echo 'A plot of the benchmark results have been uploaded as an artifact to the workflow run for this PR.' >> body.md | ||
echo 'Go to "Actions"->"Benchmark a pull request"->[the most recent run]->"Artifacts" (at the bottom).' >> body.md | ||
- name: Find Comment | ||
uses: peter-evans/find-comment@v3 | ||
id: fcbenchmark | ||
with: | ||
issue-number: ${{ github.event.pull_request.number }} | ||
comment-author: 'github-actions[bot]' | ||
body-includes: Benchmark Results | ||
- name: Comment on PR | ||
uses: peter-evans/create-or-update-comment@v4 | ||
with: | ||
comment-id: ${{ steps.fcbenchmark.outputs.comment-id }} | ||
issue-number: ${{ github.event.pull_request.number }} | ||
body-path: body.md | ||
edit-mode: replace |
Empty file.
This file was deleted.
Oops, something went wrong.
Empty file.