-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
34 changed files
with
474 additions
and
114 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 |
---|---|---|
@@ -0,0 +1,55 @@ | ||
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 | ||
|
||
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@v2 | ||
- 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 | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
alert-threshold: "200%" | ||
fail-on-alert: true | ||
benchmark-data-dir-path: benchmarks | ||
max-items-in-chart: 100 | ||
auto-push: ${{ github.event_name != 'pull_request' }} |
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
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
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,7 +1,10 @@ | ||
.DS_Store | ||
|
||
*.jl.*.cov | ||
*.jl.cov | ||
*.jl.mem | ||
Manifest.toml | ||
docs/build/ | ||
.vscode | ||
|
||
.vscode | ||
*.json |
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
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
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[deps] | ||
BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf" | ||
QuantumToolbox = "6c2fb7c5-b903-41d2-bc5e-5a7c320b9fab" |
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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
function benchmark_correlations_and_spectrum() | ||
N = 15 | ||
ω = 1 | ||
γ = 0.1 | ||
nth = 0.02 | ||
|
||
a = destroy(N) | ||
H = ω * a' * a | ||
c_ops = [sqrt(γ * (nth + 1)) * a, sqrt(γ * nth) * a'] | ||
|
||
ω_l = range(0, 3, length=1000) | ||
|
||
SUITE["Correlations and Spectrum"]["FFT Correlation"] = @benchmarkable spectrum($H, $ω_l, $(a'), $a, $c_ops, solver=FFTCorrelation(), progress_bar=false) | ||
|
||
SUITE["Correlations and Spectrum"]["Exponential Series"] = @benchmarkable spectrum($H, $ω_l, $(a'), $a, $c_ops) | ||
end | ||
|
||
benchmark_correlations_and_spectrum() |
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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
function H_dfd2(dims, p) | ||
Δ = p.Δ | ||
F = p.F | ||
J = p.J | ||
a = tensor(destroy(dims[1]), qeye(dims[2])) | ||
b = tensor(qeye(dims[1]), destroy(dims[2])) | ||
Δ * a' * a + F * (a + a') + Δ * b' * b + J * (a' * b + a * b') | ||
end | ||
function c_ops_dfd2(dims, p) | ||
κ = p.κ | ||
a = tensor(destroy(dims[1]), qeye(dims[2])) | ||
b = tensor(qeye(dims[1]), destroy(dims[2])) | ||
[√κ * a, √κ * b] | ||
end | ||
function e_ops_dfd2(dims, p) | ||
a = tensor(destroy(dims[1]), qeye(dims[2])) | ||
b = tensor(qeye(dims[1]), destroy(dims[2])) | ||
[a' * a, b' * b] | ||
end | ||
|
||
function benchmark_dfd() | ||
F, Δ, κ, J = 1, 0.25, 1, 0.05 | ||
maxdims = [50, 50] | ||
|
||
ψ0 = tensor(fock(3, 0), fock(20, 15)) | ||
dfd_params = (Δ=Δ, F=F, κ=κ, J=J) | ||
|
||
tlist = range(0, 15 / κ, 100) | ||
|
||
SUITE["Time Evolution"]["Dynamical Fock Dimension"] = @benchmarkable dfd_mesolve(H_dfd2, $ψ0, $tlist, c_ops_dfd2, $maxdims, $dfd_params, e_ops=e_ops_dfd2, progress_bar=false) | ||
end | ||
|
||
benchmark_dfd() |
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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
function benchmark_eigenvalues() | ||
N = 5 | ||
a = tensor(destroy(N), qeye(N)) | ||
a_d = a' | ||
b = tensor(qeye(N), destroy(N)) | ||
b_d = b' | ||
|
||
ωc = 1 | ||
ωb = 1 | ||
g = 0.2 | ||
κ = 0.01 | ||
n_thermal = 0.1 | ||
|
||
H = ωc * a_d * a + ωb * b_d * b + g * (a + a_d) * (b + b_d) | ||
c_ops = [√((1+n_thermal)*κ) * a, √κ * b, √(n_thermal*κ) * a_d] | ||
L = liouvillian(H, c_ops) | ||
|
||
SUITE["Eigenvalues"]["eigenstates"]["dense"] = @benchmarkable eigenstates($L) | ||
SUITE["Eigenvalues"]["eigenstates"]["sparse"] = @benchmarkable eigenstates($L, sparse=true, sigma=0.01, k=5) | ||
end | ||
|
||
benchmark_eigenvalues() |
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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using BenchmarkTools | ||
using QuantumToolbox | ||
|
||
BLAS.set_num_threads(1) | ||
|
||
const SUITE = BenchmarkGroup() | ||
|
||
include("correlations_and_spectrum.jl") | ||
include("dynamical_fock_dimension.jl") | ||
include("eigenvalues.jl") | ||
include("steadystate.jl") | ||
include("timeevolution.jl") | ||
|
||
BenchmarkTools.tune!(SUITE) | ||
results = BenchmarkTools.run(SUITE, verbose = true) | ||
display(median(results)) | ||
|
||
BenchmarkTools.save("benchmarks_output.json", median(results)) |
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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
function benchmark_steadystate() | ||
N = 50 | ||
Δ = 0.1 | ||
F = 2 | ||
γ = 1 | ||
nth = 5 | ||
|
||
a = destroy(N) | ||
H = Δ * a' * a + F * (a + a') | ||
c_ops = [sqrt(γ * (nth + 1)) * a, sqrt(γ * nth) * a'] | ||
|
||
SUITE["Steadystate"]["Direct"] = @benchmarkable steadystate($H, $c_ops) | ||
end | ||
|
||
benchmark_steadystate() |
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 |
---|---|---|
@@ -0,0 +1,47 @@ | ||
function benchmark_timeevolution() | ||
ωc = 1 | ||
ωq = 1 | ||
g = 0.1 | ||
ωd = 0.99 | ||
F = 0.07 | ||
|
||
Δc = ωc - ωd | ||
Δq = ωq - ωd | ||
|
||
# Operators definition | ||
N = 20 # cutoff for the cavity Hilbert space | ||
a = tensor(destroy(N), qeye(2)) | ||
σm = tensor(qeye(N), sigmam()) | ||
σz = tensor(qeye(N), sigmaz()) | ||
|
||
# Hamiltonian | ||
H = Δc * a' * a + Δq * σz / 2 + g * (a' * σm + a * σm') + F * (a + a') | ||
|
||
e_ops = [a'*a, σz] | ||
|
||
# Initial state | ||
ψ0 = tensor(coherent(N, 0), fock(2, 1)) | ||
|
||
## sesolve ## | ||
|
||
tlist = range(0, 2π * 10 / g, 1000) | ||
|
||
SUITE["Time Evolution"]["time-independent"]["sesolve"] = @benchmarkable sesolve($H, $ψ0, $tlist, e_ops=$e_ops, progress_bar=false) | ||
|
||
## mesolve ## | ||
|
||
nth = 0.01 | ||
γ = 0.05 | ||
c_ops = [sqrt(γ * (nth + 1)) * a, sqrt(γ * nth) * a', sqrt(γ) * σm] | ||
|
||
tlist = range(0, 10/γ, 100) | ||
|
||
SUITE["Time Evolution"]["time-independent"]["mesolve"] = @benchmarkable mesolve($H, $ψ0, $tlist, $c_ops, e_ops=$e_ops, progress_bar=false) | ||
|
||
## mcsolve ## | ||
|
||
SUITE["Time Evolution"]["time-independent"]["mcsolve"]["Serial"] = @benchmarkable mcsolve($H, $ψ0, $tlist, $c_ops, n_traj=100, e_ops=$e_ops, progress_bar=false, ensemble_method=EnsembleSerial()) | ||
SUITE["Time Evolution"]["time-independent"]["mcsolve"]["Multithreaded"] = @benchmarkable mcsolve($H, $ψ0, $tlist, $c_ops, n_traj=100, e_ops=$e_ops, progress_bar=false, ensemble_method=EnsembleThreads()) | ||
end | ||
|
||
benchmark_timeevolution() |
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,4 +1,3 @@ | ||
[deps] | ||
CairoMakie = "13f3f980-e62b-5c42-98c6-ff1f3baf88f0" | ||
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" | ||
LaTeXStrings = "b964fa9f-0449-5b57-a5c2-d3ea65f4040f" | ||
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80" |
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
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
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
```@raw html | ||
<iframe src="https://albertomercurio.github.io/QuantumToolbox.jl/benchmarks/" style="width:100%;height:500px; border: none;"></iframe> | ||
``` |
Oops, something went wrong.