Skip to content

Commit 9ea5906

Browse files
committed
Benchmark ODEProblem/f_iip/f_oop with sparse+analytical Jacobian
1 parent 3db221b commit 9ea5906

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

benchmark/benchmarks.jl

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,3 +76,18 @@ prob = ODEProblem(model, u0, tspan)
7676
large_param_init["ODEProblem"] = @benchmarkable ODEProblem($model, $u0, $tspan)
7777

7878
large_param_init["init"] = @benchmarkable init($prob)
79+
80+
sparse_analytical_jacobian = SUITE["sparse_analytical_jacobian"]
81+
82+
eqs = [D(x[i]) ~ prod(x[j] for j in 1:N if (i+j) % 3 == 0) for i in 1:N]
83+
@mtkcompile model = System(eqs, t)
84+
u0 = collect(x .=> 1.0)
85+
tspan = (0.0, 1.0)
86+
jac = true
87+
sparse = true
88+
prob = ODEProblem(model, u0, tspan; jac, sparse)
89+
out = similar(prob.f.jac_prototype)
90+
91+
sparse_analytical_jacobian["ODEProblem"] = @benchmarkable ODEProblem($model, $u0, $tspan; jac, sparse)
92+
sparse_analytical_jacobian["f_oop"] = @benchmarkable $(prob.f.jac.f_oop)($(prob.u0), $(prob.p), $(first(tspan)))
93+
sparse_analytical_jacobian["f_iip"] = @benchmarkable $(prob.f.jac.f_iip)($out, $(prob.u0), $(prob.p), $(first(tspan)))

0 commit comments

Comments
 (0)