Skip to content

Commit

Permalink
Merge pull request #978 from SciML/ChrisRackauckas-patch-1
Browse files Browse the repository at this point in the history
MTK Benchmarks
  • Loading branch information
ChrisRackauckas authored Jun 23, 2024
2 parents 1397725 + 0ddebb7 commit 7d5ede5
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 14 deletions.
3 changes: 2 additions & 1 deletion benchmarks/ModelingToolkit/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ OMJulia = "0f4fe800-344e-11e9-2949-fb537ad918e1"
OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed"
Polynomials = "f27b6e38-b328-58d1-80ce-0feddd5e7a45"
PreferenceTools = "ba661fbb-e901-4445-b070-854aec6bfbc5"
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
SciMLBenchmarks = "31c91b34-3c75-11e9-0341-95557aab0344"
Symbolics = "0c5d862f-8b57-4792-8d23-62f2024744c7"

Expand All @@ -23,7 +24,7 @@ CSV = "0.10"
JuliaSimCompiler = "0.1.9"
JuliaSimCompilerRuntime = "1.0.0"
LinearSolve = "2.30.0"
ModelingToolkit = "9.15.0"
ModelingToolkit = "9.19.0"
ModelingToolkitStandardLibrary = "2"
OMJulia = "0.3.1"
OrdinaryDiffEq = "6.81.0"
Expand Down
4 changes: 2 additions & 2 deletions benchmarks/ModelingToolkit/RCCircuit.jmd
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ end
N = [5, 10, 20, 40, 60, 80, 160, 320, 480, 640, 800, 1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000, 20000];

# max size we test per method
max_sizes = [4_000, 8_000, 20_000, 20_000, 20_000, 20_000, 20_000, 9000];
max_sizes = [4_000, 8_000, 20_000, 20_000, 20_000, 20_000, 20_000, 9000, 20_000];

# NaN-initialize so Makie will ignore incomplete
ss_times = fill(NaN, length(N), 3);
Expand Down Expand Up @@ -212,7 +212,7 @@ ax = Axis(f2[1, 1]; yscale = log10, xscale = log10, title)
names = ["MTK", "JSIR - Scalar - Julia", "JSIR - Scalar - C", "JSIR - Scalar - LLVM", "JSIR - Loop - Julia", "JSIR - Loop - C", "JSIR - Loop - LLVM", "OpenModelica", "Dymola"]
_lines = map(enumerate(names)) do (j, label)
ts = @view(total_times[:, j])
lines!(N_states, ts)
lines!(N, ts)
end
Legend(f2[1,2], _lines, names)
f2
Expand Down
17 changes: 6 additions & 11 deletions benchmarks/ModelingToolkit/ThermalFluid.jmd
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ end
N = [5, 10, 20, 40, 60, 80, 160, 320, 480, 640, 800, 960, 1280];
N_states = 4 .* N; # x-axis for plots
# max size we test per method
max_sizes = [480, last(N), last(N), last(N), last(N)];
max_sizes = [480, last(N), last(N), last(N), last(N), last(N)];
# NaN-initialize so Makie will ignore incomplete
ss_times = fill(NaN, length(N), 2);
times = fill((NaN,NaN,NaN), length(N), length(max_sizes) - 1);
Expand Down Expand Up @@ -332,12 +332,12 @@ resultfile = "modelica_res.csv"
@show "Start OpenModelica Timings"

for i in 1:length(N)
N = N[i]
N > max_sizes[end] && break
@show N
_N = N[i]
_N > max_sizes[end] && break
@show _N
totaltime = @elapsed res = begin
@sync ModelicaSystem(mod, modelicafile, "DhnControl.Test.test_preinsulated_470_$N")
sendExpression(mod, "simulate(DhnControl.Test.test_preinsulated_470_$N)")
@sync ModelicaSystem(mod, modelicafile, "DhnControl.Test.test_preinsulated_470_$(_N)")
sendExpression(mod, "simulate(DhnControl.Test.test_preinsulated_470_$(_N))")
end
#runtime = res["timeTotal"]
@assert res["messages"][1:11] == "LOG_SUCCESS"
Expand Down Expand Up @@ -390,11 +390,6 @@ for (i, timecat) in enumerate(("ODEProblem + f!", "Run", "Solve"))
end
Legend(f[i+1, 2], _lines, method_names)
end
let method_names_m = vcat(method_names, "OpenModelica");
ax = Axis(f[5, 1]; yscale = log10, xscale = log10, title = "Total Time")
_lines = map(Base.Fix1(lines!, N), eachcol(total_times))
Legend(f[5, 2], _lines, method_names_m)
end
f
```

Expand Down

0 comments on commit 7d5ede5

Please sign in to comment.