Skip to content

Commit

Permalink
Merge pull request #96 from albertomercurio/dev/patch-3
Browse files Browse the repository at this point in the history
Add benchmark tracking
  • Loading branch information
albertomercurio authored May 5, 2024
2 parents 0f43c6e + d61667d commit c79aae0
Show file tree
Hide file tree
Showing 4 changed files with 97 additions and 1 deletion.
62 changes: 62 additions & 0 deletions .github/workflows/Benchmarks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Benchmark Tracking
on:
push:
branches:
- 'main'
paths-ignore:
- 'docs/**'
pull_request:
branches:
- 'main'
paths-ignore:
- 'docs/**'
types:
- opened
- reopened
- synchronize
- ready_for_review

permissions:
actions: write
contents: write
deployments: write

concurrency:
# Skip intermediate builds: always.
# Cancel intermediate builds: only if it is a pull request build.
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}

jobs:
benchmark:
runs-on: ubuntu-latest
if: ${{ !github.event.pull_request.draft }}
steps:
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v2
with:
version: '1'
arch: x64
- uses: julia-actions/cache@v1
- name: Run benchmark
run: |
cd benchmarks
julia --project --threads=2 --color=yes -e '
using Pkg;
Pkg.develop(PackageSpec(path=joinpath(pwd(), "..")));
Pkg.instantiate();
include("runbenchmarks.jl")'
- name: Parse & Upload Benchmark Results
uses: benchmark-action/github-action-benchmark@v1
with:
name: Benchmark results
tool: "julia"
output-file-path: benchmarks/benchmarks_output.json
summary-always: true
github-token: ${{ secrets.GITHUB_TOKEN }}
comment-always: true
alert-threshold: "200%"
fail-on-alert: true
benchmark-data-dir-path: benchmarks
auto-push: ${{ github.event_name != 'pull_request' }}
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
.DS_Store

*.jl.*.cov
*.jl.cov
*.jl.mem
Manifest.toml
docs/build/
.vscode

.vscode
*.json
3 changes: 3 additions & 0 deletions benchmarks/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[deps]
BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"
QuantumToolbox = "6c2fb7c5-b903-41d2-bc5e-5a7c320b9fab"
28 changes: 28 additions & 0 deletions benchmarks/runbenchmarks.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using BenchmarkTools
using QuantumToolbox

suite = BenchmarkGroup()

suite["steadystate"] = BenchmarkGroup(["steadystate"])


## steadystate ##

N = 50
Δ = 0.1
F = 2
γ = 1
a = destroy(N)
H = Δ * a' * a + F * (a + a')
c_ops = [sqrt(γ) * a]

suite["steadystate"]["driven-dissipative harmonic oscillator"] = @benchmarkable steadystate($H, $c_ops)

## end ##


BenchmarkTools.tune!(suite)
results = run(suite, verbose = true)
display(median(results))

BenchmarkTools.save(joinpath(@__DIR__, "benchmarks_output.json"), median(results))

0 comments on commit c79aae0

Please sign in to comment.