Skip to content

Commit a4f6aab

Browse files
Add AirspeedVelocity benchmarking CI
Adds a benchmark workflow (Julia 1 and lts) and a benchmark/benchmarks.jl suite covering representative workloads so PRs check for performance regressions. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> Agent-Harness: devin 3000.10.21 Agent-Model: SWE-2 Max Agent-Session: local session transcript /home/crackauc/.local/share/devin/cli/summaries/history_ccb52064e6514b21.md
1 parent f1d1f81 commit a4f6aab

2 files changed

Lines changed: 68 additions & 0 deletions

File tree

‎.github/workflows/benchmark.yml‎

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Benchmark this PR
2+
3+
on:
4+
pull_request:
5+
branches: [master]
6+
paths-ignore: ['docs/**']
7+
8+
permissions:
9+
pull-requests: write
10+
contents: read
11+
12+
jobs:
13+
benchmark:
14+
runs-on: ubuntu-latest
15+
timeout-minutes: 30
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
version: ["1", "lts"]
20+
env:
21+
# Force consistent Julia depot path for self-hosted runners
22+
JULIA_DEPOT_PATH: ~/.julia
23+
steps:
24+
- uses: MilesCranmer/AirspeedVelocity.jl@action-v1
25+
with:
26+
julia-version: ${{ matrix.version }}
27+
script: "benchmark/benchmarks.jl"
28+
extra-pkgs: "OrdinaryDiffEqTsit5,StableRNGs"
29+
job-summary: true

‎benchmark/benchmarks.jl‎

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
using DiffEqGPU, BenchmarkTools
2+
using OrdinaryDiffEqTsit5, StableRNGs
3+
4+
const SUITE = BenchmarkGroup()
5+
const rng = StableRNG(123)
6+
7+
function lorenz(du, u, p, t)
8+
du[1] = p[1] * (u[2] - u[1])
9+
du[2] = u[1] * (p[2] - u[3]) - u[2]
10+
return du[3] = u[1] * u[2] - p[3] * u[3]
11+
end
12+
13+
u0 = Float32[1.0; 0.0; 0.0]
14+
tspan = (0.0f0, 50.0f0)
15+
p = (10.0f0, 28.0f0, 8 / 3.0f0)
16+
prob = ODEProblem(lorenz, u0, tspan, p)
17+
pre_p = [rand(rng, Float32, 3) for i in 1:32]
18+
prob_func = (prob, ctx) -> remake(prob, p = pre_p[ctx.sim_id] .* p)
19+
monteprob = EnsembleProblem(prob; prob_func)
20+
21+
# =============================================================================
22+
# Ensemble solving on the CPU-array backend
23+
# =============================================================================
24+
25+
SUITE["ensemble"] = BenchmarkGroup()
26+
27+
SUITE["ensemble"]["cpu_array_16"] = @benchmarkable solve(
28+
$monteprob, Tsit5(), EnsembleCPUArray(); trajectories = 16, saveat = 1.0f0
29+
)
30+
SUITE["ensemble"]["cpu_array_32"] = @benchmarkable solve(
31+
$monteprob, Tsit5(), EnsembleCPUArray(); trajectories = 32, saveat = 1.0f0
32+
)
33+
SUITE["ensemble"]["threads_16"] = @benchmarkable solve(
34+
$monteprob, Tsit5(), EnsembleThreads(); trajectories = 16, saveat = 1.0f0
35+
)
36+
SUITE["ensemble"]["cpu_array_batch"] = @benchmarkable solve(
37+
$monteprob, Tsit5(), EnsembleCPUArray(); trajectories = 32,
38+
batch_size = 8, saveat = 1.0f0
39+
)

0 commit comments

Comments
 (0)