Skip to content

Commit 53d6751

Browse files
committed
Add instructions to locally run the benchmarks
1 parent 092e544 commit 53d6751

File tree

3 files changed

+43
-23
lines changed

3 files changed

+43
-23
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,6 @@ Manifest.toml
66
.vscode/*
77
wip
88
/.benchmarkci
9-
/benchmark/*.json
9+
/benchmark/*.json
10+
*.json
11+
*.json.tmp

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,13 @@ using Preferences, UUIDs
5959
Preferences.set_preferences!(UUID("764a87c0-6b3e-53db-9096-fe964310641d"),
6060
"PrecompileShooting" => false)
6161
```
62+
63+
## Running Benchmarks Locally
64+
65+
We include a small set of benchmarks in the `benchmarks` folder. These are not extensive and mainly used to track regressions during development. For more extensive benchmarks, see the [SciMLBenchmarks](https://github.com/SciML/SciMLBenchmarks.jl) repository.
66+
67+
To run benchmarks locally install [AirspeedVelocity.jl](https://github.com/MilesCranmer/AirspeedVelocity.jl) and run the following command in the package directory:
68+
69+
```bash
70+
benchpkg BoundaryValueDiffEq --rev="master,<git sha for your commit>" --bench-on="master"
71+
```

benchmark/simple_pendulum.jl

Lines changed: 30 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ function bc_pendulum(u, p, t)
2828
return [u((t0 + t1) / 2)[1] + π / 2, u(t1)[1] - π / 2]
2929
end
3030

31-
const prob_oop = BVProblem(simple_pendulum, bc_pendulum, [π / 2, π / 2], tspan)
32-
const prob_iip = BVProblem(simple_pendulum!, bc_pendulum!, [π / 2, π / 2], tspan)
31+
const prob_oop = BVProblem{false}(simple_pendulum, bc_pendulum, [π / 2, π / 2], tspan)
32+
const prob_iip = BVProblem{true}(simple_pendulum!, bc_pendulum!, [π / 2, π / 2], tspan)
3333

3434
end
3535

@@ -42,27 +42,35 @@ function create_simple_pendulum_benchmark()
4242
suite["IIP"] = iip_suite
4343
suite["OOP"] = oop_suite
4444

45-
iip_suite["MultipleShooting(100, Tsit5; grid_coarsening = true)"] = @benchmarkable solve($SimplePendulumBenchmark.prob_iip,
46-
$MultipleShooting(100, Tsit5()))
47-
iip_suite["MultipleShooting(100, Tsit5; grid_coarsening = false)"] = @benchmarkable solve($SimplePendulumBenchmark.prob_iip,
48-
$MultipleShooting(100, Tsit5(); grid_coarsening = false))
49-
iip_suite["MultipleShooting(10, Tsit5; grid_coarsening = true)"] = @benchmarkable solve($SimplePendulumBenchmark.prob_iip,
50-
$MultipleShooting(10, Tsit5()))
51-
iip_suite["MultipleShooting(10, Tsit5; grid_coarsening = false)"] = @benchmarkable solve($SimplePendulumBenchmark.prob_iip,
52-
$MultipleShooting(10, Tsit5(); grid_coarsening = false))
53-
iip_suite["Shooting(Tsit5())"] = @benchmarkable solve($SimplePendulumBenchmark.prob_iip,
54-
$Shooting(Tsit5()))
45+
if @isdefined(MultipleShooting)
46+
iip_suite["MultipleShooting(100, Tsit5; grid_coarsening = true)"] = @benchmarkable solve($SimplePendulumBenchmark.prob_iip,
47+
$MultipleShooting(100, Tsit5()))
48+
iip_suite["MultipleShooting(100, Tsit5; grid_coarsening = false)"] = @benchmarkable solve($SimplePendulumBenchmark.prob_iip,
49+
$MultipleShooting(100, Tsit5(); grid_coarsening = false))
50+
iip_suite["MultipleShooting(10, Tsit5; grid_coarsening = true)"] = @benchmarkable solve($SimplePendulumBenchmark.prob_iip,
51+
$MultipleShooting(10, Tsit5()))
52+
iip_suite["MultipleShooting(10, Tsit5; grid_coarsening = false)"] = @benchmarkable solve($SimplePendulumBenchmark.prob_iip,
53+
$MultipleShooting(10, Tsit5(); grid_coarsening = false))
54+
end
55+
if @isdefined(Shooting)
56+
iip_suite["Shooting(Tsit5())"] = @benchmarkable solve($SimplePendulumBenchmark.prob_iip,
57+
$Shooting(Tsit5()))
58+
end
5559

56-
oop_suite["MultipleShooting(100, Tsit5; grid_coarsening = true)"] = @benchmarkable solve($SimplePendulumBenchmark.prob_oop,
57-
$MultipleShooting(100, Tsit5()))
58-
oop_suite["MultipleShooting(100, Tsit5; grid_coarsening = false)"] = @benchmarkable solve($SimplePendulumBenchmark.prob_oop,
59-
$MultipleShooting(100, Tsit5(); grid_coarsening = false))
60-
oop_suite["MultipleShooting(10, Tsit5; grid_coarsening = true)"] = @benchmarkable solve($SimplePendulumBenchmark.prob_oop,
61-
$MultipleShooting(10, Tsit5()))
62-
oop_suite["MultipleShooting(10, Tsit5; grid_coarsening = false)"] = @benchmarkable solve($SimplePendulumBenchmark.prob_oop,
63-
$MultipleShooting(10, Tsit5(); grid_coarsening = false))
64-
oop_suite["Shooting(Tsit5())"] = @benchmarkable solve($SimplePendulumBenchmark.prob_oop,
65-
$Shooting(Tsit5()))
60+
if @isdefined(MultipleShooting)
61+
oop_suite["MultipleShooting(100, Tsit5; grid_coarsening = true)"] = @benchmarkable solve($SimplePendulumBenchmark.prob_oop,
62+
$MultipleShooting(100, Tsit5()))
63+
oop_suite["MultipleShooting(100, Tsit5; grid_coarsening = false)"] = @benchmarkable solve($SimplePendulumBenchmark.prob_oop,
64+
$MultipleShooting(100, Tsit5(); grid_coarsening = false))
65+
oop_suite["MultipleShooting(10, Tsit5; grid_coarsening = true)"] = @benchmarkable solve($SimplePendulumBenchmark.prob_oop,
66+
$MultipleShooting(10, Tsit5()))
67+
oop_suite["MultipleShooting(10, Tsit5; grid_coarsening = false)"] = @benchmarkable solve($SimplePendulumBenchmark.prob_oop,
68+
$MultipleShooting(10, Tsit5(); grid_coarsening = false))
69+
end
70+
if @isdefined(Shooting)
71+
oop_suite["Shooting(Tsit5())"] = @benchmarkable solve($SimplePendulumBenchmark.prob_oop,
72+
$Shooting(Tsit5()))
73+
end
6674

6775
return suite
6876
end

0 commit comments

Comments
 (0)