From 9ca016fc9233dda7fe37b4af98d13498edd8e9cd Mon Sep 17 00:00:00 2001 From: Nathanael Bosch Date: Sat, 4 Nov 2023 17:31:03 +0100 Subject: [PATCH] vdp benchmark --- docs/src/benchmarks/figures/vanderpol_2_1.svg | 250 +++++----- docs/src/benchmarks/figures/vanderpol_3_1.svg | 428 +++++++++--------- docs/src/benchmarks/figures/vanderpol_5_1.svg | 372 ++++++--------- docs/src/benchmarks/vanderpol.md | 119 +++-- 4 files changed, 552 insertions(+), 617 deletions(-) diff --git a/docs/src/benchmarks/figures/vanderpol_2_1.svg b/docs/src/benchmarks/figures/vanderpol_2_1.svg index 8c6033f49..f075bb00f 100644 --- a/docs/src/benchmarks/figures/vanderpol_2_1.svg +++ b/docs/src/benchmarks/figures/vanderpol_2_1.svg @@ -1,140 +1,140 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/src/benchmarks/figures/vanderpol_3_1.svg b/docs/src/benchmarks/figures/vanderpol_3_1.svg index e178b22bf..bd9f0e096 100644 --- a/docs/src/benchmarks/figures/vanderpol_3_1.svg +++ b/docs/src/benchmarks/figures/vanderpol_3_1.svg @@ -1,229 +1,227 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/src/benchmarks/figures/vanderpol_5_1.svg b/docs/src/benchmarks/figures/vanderpol_5_1.svg index e6f8321e7..ee0aec004 100644 --- a/docs/src/benchmarks/figures/vanderpol_5_1.svg +++ b/docs/src/benchmarks/figures/vanderpol_5_1.svg @@ -1,258 +1,140 @@ - + - + - + - + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/src/benchmarks/vanderpol.md b/docs/src/benchmarks/vanderpol.md index d864cc063..a9b690b29 100644 --- a/docs/src/benchmarks/vanderpol.md +++ b/docs/src/benchmarks/vanderpol.md @@ -75,6 +75,61 @@ plot(wp, palette=Plots.palette([:blue, :red], length(_setups)), xticks = 10.0 .^ +## Comparison of the different initialization schemes + +```julia +DENSE = false; +SAVE_EVERYSTEP = false; + +abstols = 1.0 ./ 10.0 .^ (6:13) +reltols = 1.0 ./ 10.0 .^ (3:10) + +orders = (2, 3, 5, 8) +ps = [] +for o in orders + _setups = [ + "EK1($o) TaylorInit" => Dict(:alg => EK1(order=o, smooth=DENSE, initialization=TaylorModeInit(o))) + "EK1($o) ForwardDiffInit" => Dict(:alg => EK1(order=o, smooth=DENSE, initialization=ForwardDiffInit(o))) + "EK1($o) SimpleInit" => Dict(:alg => EK1(order=o, smooth=DENSE, initialization=SimpleInit())) + "EK1($o) ClassicSolverInit" => Dict(:alg => EK1(order=o, smooth=DENSE, initialization=ClassicSolverInit())) + ] + + labels = first.(_setups) + setups = last.(_setups) + + wp = WorkPrecisionSet( + prob, abstols, reltols, setups; + names = labels, + #print_names = true, + appxsol = test_sol, + dense = DENSE, + save_everystep = SAVE_EVERYSTEP, + numruns = 10, + maxiters = Int(1e7), + timeseries_errors = false, + verbose = false, + ) + + p = plot(wp, color=[2 4 5 6], xticks = 10.0 .^ (-16:1:5)) + push!(ps, p) +end +plot( + ps..., + layout=(length(orders), 1), + size = (1000, length(orders)*300), + xlabel=["" "" "" "Error"], +) +``` + +``` +Error: PosDefException: matrix is not Hermitian; Cholesky factorization fai +led. +``` + + + + + ## Solving the first- vs second-order ODE ```julia @@ -91,7 +146,7 @@ test_sol2 = solve(prob2, RadauIIA5(), abstol=1/10^14, reltol=1/10^14, dense=fals plot(test_sol2, title="Van der Pol Solution (2nd order)", legend=false, ylims=(-2.5, 2.5)) ``` -![](figures/vanderpol_4_1.svg) +![](figures/vanderpol_5_1.svg) ```julia DENSE = false; @@ -130,7 +185,7 @@ wp = WorkPrecisionSet( plot(wp, color=[1 1 1 1 2 2 2 2], xticks = 10.0 .^ (-16:1:5)) ``` -![](figures/vanderpol_5_1.svg) +![](figures/vanderpol_6_1.svg) @@ -164,6 +219,7 @@ Platform Info: Environment: JULIA_NUM_THREADS = auto JULIA_STACKTRACE_MINIMAL = true + JULIA_IMAGE_THREADS = 1 ``` @@ -186,14 +242,14 @@ Status `~/.julia/dev/ProbNumDiffEq/benchmarks/Project.toml` [961ee093] ModelingToolkit v8.72.2 [54ca160b] ODEInterface v0.5.0 [09606e27] ODEInterfaceDiffEq v3.13.3 - [1dea7af3] OrdinaryDiffEq v6.58.0 + [1dea7af3] OrdinaryDiffEq v6.58.1 [65888b18] ParameterizedFunctions v5.16.0 [91a5bcdd] Plots v1.39.0 - [bf3e78b0] ProbNumDiffEq v0.12.1 `~/.julia/dev/ProbNumDiffEq` - [0bca4576] SciMLBase v2.4.3 + [bf3e78b0] ProbNumDiffEq v0.13.0 `~/.julia/dev/ProbNumDiffEq` + [0bca4576] SciMLBase v2.7.3 [505e40e9] SciPyDiffEq v0.2.1 [90137ffa] StaticArrays v1.6.5 - [c3572dad] Sundials v4.20.0 + [c3572dad] Sundials v4.20.1 [44d3d7a6] Weave v0.10.12 [0518478a] deSolveDiffEq v0.1.1 ``` @@ -213,16 +269,15 @@ Status `~/.julia/dev/ProbNumDiffEq/benchmarks/Manifest.toml` ⌅ [c3fe647b] AbstractAlgebra v0.32.5 [621f4979] AbstractFFTs v1.5.0 [1520ce14] AbstractTrees v0.4.4 - [79e6a3ab] Adapt v3.7.0 + [79e6a3ab] Adapt v3.7.1 [ec485272] ArnoldiMethod v0.2.0 [c9d4266f] ArrayAllocators v0.3.0 - [4fba245c] ArrayInterface v7.4.11 - [30b0a656] ArrayInterfaceCore v0.1.29 + [4fba245c] ArrayInterface v7.5.1 [6e4b80f9] BenchmarkTools v1.3.2 [e2ed5e7c] Bijections v0.1.6 [d1d4a3ce] BitFlags v0.1.7 [62783981] BitTwiddlingConvenienceFunctions v0.1.5 -⌅ [fa961155] CEnum v0.4.2 + [fa961155] CEnum v0.5.0 [2a0fbf3d] CPUSummary v0.2.4 [00ebfdb7] CSTParser v3.3.6 [49dc2e85] Calculus v0.5.1 @@ -241,7 +296,7 @@ Status `~/.julia/dev/ProbNumDiffEq/benchmarks/Manifest.toml` [34da2185] Compat v4.10.0 [b152e2b5] CompositeTypes v0.1.3 [2569d6c7] ConcreteStructs v0.2.3 - [f0e56b4a] ConcurrentUtilities v2.2.1 + [f0e56b4a] ConcurrentUtilities v2.3.0 [8f4d0f93] Conda v1.9.1 [187b0558] ConstructionBase v1.5.4 [d38c429a] Contour v0.6.2 @@ -254,21 +309,21 @@ Status `~/.julia/dev/ProbNumDiffEq/benchmarks/Manifest.toml` [864edb3b] DataStructures v0.18.15 [e2d170a0] DataValueInterfaces v1.0.0 [8bb1440f] DelimitedFiles v1.9.1 - [2b5f629d] DiffEqBase v6.134.0 + [2b5f629d] DiffEqBase v6.138.0 [459566f4] DiffEqCallbacks v2.33.1 [f3b72e0c] DiffEqDevTools v2.39.0 [77a26b50] DiffEqNoiseProcess v5.19.0 [163ba53b] DiffResults v1.1.0 [b552c78f] DiffRules v1.15.1 [b4f34e82] Distances v0.10.10 - [31c24e10] Distributions v0.25.102 + [31c24e10] Distributions v0.25.103 [ffbed154] DocStringExtensions v0.9.3 ⌅ [5b8099bc] DomainSets v0.6.7 [fa6b7ba4] DualNumbers v0.6.8 [7c1d4256] DynamicPolynomials v0.5.3 [b305315f] Elliptic v1.0.1 [4e289a0a] EnumX v1.0.4 - [f151be2c] EnzymeCore v0.6.2 + [f151be2c] EnzymeCore v0.6.3 [6912e4f1] Espresso v0.6.1 [460bff9d] ExceptionUnwrapping v0.1.9 [d4d017d3] ExponentialUtilities v1.25.0 @@ -294,7 +349,7 @@ Status `~/.julia/dev/ProbNumDiffEq/benchmarks/Manifest.toml` [c27321d9] Glob v1.3.1 [86223c79] Graphs v1.9.0 [42e2da0e] Grisu v1.0.2 - [0b43b601] Groebner v0.4.4 +⌅ [0b43b601] Groebner v0.4.4 [d5909c97] GroupsCore v0.4.0 [cd3eb016] HTTP v1.10.0 [eafb193a] Highlights v0.5.2 @@ -313,26 +368,27 @@ Status `~/.julia/dev/ProbNumDiffEq/benchmarks/Manifest.toml` [1019f520] JLFzf v0.1.6 [692b3bcd] JLLWrappers v1.5.0 [682c06a0] JSON v0.21.4 - [98e50ef6] JuliaFormatter v1.0.40 + [98e50ef6] JuliaFormatter v1.0.42 [ccbc3e58] JumpProcesses v9.8.0 [ef3ab10e] KLU v0.4.1 [2c470bb0] Kronecker v0.5.4 [ba0b0d4f] Krylov v0.9.4 [7f56f5a3] LSODA v0.7.5 - [b964fa9f] LaTeXStrings v1.3.0 + [b964fa9f] LaTeXStrings v1.3.1 [2ee39098] LabelledArrays v1.14.0 [984bce1d] LambertW v0.4.6 [23fbe1c1] Latexify v0.16.1 - [10f19ff3] LayoutPointers v0.1.14 + [10f19ff3] LayoutPointers v0.1.15 [50d2b5c4] Lazy v0.15.1 [1d6d02ad] LeftChildRightSiblingTrees v0.2.0 [d3d80556] LineSearches v7.2.0 - [7ed4a6bd] LinearSolve v2.12.1 + [7ed4a6bd] LinearSolve v2.15.0 [2ab3a3ac] LogExpFunctions v0.3.26 [e6f89c97] LoggingExtras v1.0.3 - [bdcacae8] LoopVectorization v0.12.165 + [bdcacae8] LoopVectorization v0.12.166 [10e44e05] MATLAB v0.8.4 [e2752cbe] MATLABDiffEq v1.2.0 + [33e6dc65] MKL v0.6.1 [d8e11817] MLStyle v0.4.17 [1914dd2f] MacroTools v0.5.11 [d125e4d3] ManualMemory v0.1.8 @@ -342,13 +398,13 @@ Status `~/.julia/dev/ProbNumDiffEq/benchmarks/Manifest.toml` [961ee093] ModelingToolkit v8.72.2 [46d2c3a1] MuladdMacro v0.2.4 [102ac46a] MultivariatePolynomials v0.5.2 - [ffc61752] Mustache v1.0.17 + [ffc61752] Mustache v1.0.18 [d8a4904e] MutableArithmetics v1.3.3 [d41bc354] NLSolversBase v7.8.3 [2774e3e8] NLsolve v4.5.1 [77ba4419] NaNMath v1.0.2 ⌅ [356022a1] NamedDims v0.2.50 - [8913a72c] NonlinearSolve v2.4.0 + [8913a72c] NonlinearSolve v2.6.1 [54ca160b] ODEInterface v0.5.0 [09606e27] ODEInterfaceDiffEq v3.13.3 [6fd5a793] Octavian v0.3.27 @@ -356,7 +412,7 @@ Status `~/.julia/dev/ProbNumDiffEq/benchmarks/Manifest.toml` [4d8831e6] OpenSSL v1.4.1 [429524aa] Optim v1.7.8 [bac558e1] OrderedCollections v1.6.2 - [1dea7af3] OrdinaryDiffEq v6.58.0 + [1dea7af3] OrdinaryDiffEq v6.58.1 [90014a1f] PDMats v0.11.28 [fe68d972] PSDMatrices v0.4.6 [65ce6f38] PackageExtensionCompat v1.0.2 @@ -379,7 +435,7 @@ Status `~/.julia/dev/ProbNumDiffEq/benchmarks/Manifest.toml` [21216c6a] Preferences v1.4.1 [08abe8d2] PrettyTables v2.2.8 [27ebfcd6] Primes v0.5.4 - [bf3e78b0] ProbNumDiffEq v0.12.1 `~/.julia/dev/ProbNumDiffEq` + [bf3e78b0] ProbNumDiffEq v0.13.0 `~/.julia/dev/ProbNumDiffEq` [33c8b6b6] ProgressLogging v0.1.4 [438e738f] PyCall v1.96.1 [1fd47b50] QuadGK v2.9.1 @@ -400,12 +456,12 @@ Status `~/.julia/dev/ProbNumDiffEq/benchmarks/Manifest.toml` [7e49a35a] RuntimeGeneratedFunctions v0.5.12 [fdea26ae] SIMD v3.4.5 [94e857df] SIMDTypes v0.1.0 - [476501e8] SLEEFPirates v0.6.39 - [0bca4576] SciMLBase v2.4.3 + [476501e8] SLEEFPirates v0.6.42 + [0bca4576] SciMLBase v2.7.3 [e9a6253c] SciMLNLSolve v0.1.9 [c0aeaf25] SciMLOperators v0.3.6 [505e40e9] SciPyDiffEq v0.2.1 - [6c6a2e73] Scratch v1.2.0 + [6c6a2e73] Scratch v1.2.1 [91c51154] SentinelArrays v1.4.0 [efcf1570] Setfield v1.1.1 [1277b4bf] ShiftedArrays v2.0.0 @@ -417,7 +473,7 @@ Status `~/.julia/dev/ProbNumDiffEq/benchmarks/Manifest.toml` [66db9d55] SnoopPrecompile v1.0.3 [b85f4697] SoftGlobalScope v1.1.0 [a2af1166] SortingAlgorithms v1.2.0 - [47a9eef4] SparseDiffTools v2.8.0 + [47a9eef4] SparseDiffTools v2.9.2 [e56a9233] Sparspak v0.3.9 [276daf66] SpecialFunctions v2.3.1 [928aab9d] SpecialMatrices v3.0.0 @@ -433,7 +489,7 @@ Status `~/.julia/dev/ProbNumDiffEq/benchmarks/Manifest.toml` [69024149] StringEncodings v0.3.7 [892a3eda] StringManipulation v0.3.4 [09ab397b] StructArrays v0.6.16 - [c3572dad] Sundials v4.20.0 + [c3572dad] Sundials v4.20.1 [2efcf032] SymbolicIndexingInterface v0.2.2 [d1185830] SymbolicUtils v1.4.0 [0c5d862f] Symbolics v5.10.0 @@ -447,9 +503,9 @@ Status `~/.julia/dev/ProbNumDiffEq/benchmarks/Manifest.toml` [a759f4b9] TimerOutputs v0.5.23 [c751599d] ToeplitzMatrices v0.8.2 [0796e94c] Tokenize v0.5.25 - [3bb67fe8] TranscodingStreams v0.10.1 + [3bb67fe8] TranscodingStreams v0.10.2 [a2a6695c] TreeViews v0.3.0 - [d5829a12] TriangularSolve v0.1.19 + [d5829a12] TriangularSolve v0.1.20 [410a4b4d] Tricks v0.1.8 [781d530d] TruncatedStacktraces v1.4.0 [5c2747f8] URIs v1.5.1 @@ -466,7 +522,6 @@ Status `~/.julia/dev/ProbNumDiffEq/benchmarks/Manifest.toml` [1b915085] WinReg v1.0.0 [ddb6d928] YAML v0.4.9 [c2297ded] ZMQ v1.2.2 - [700de1a5] ZygoteRules v0.2.4 [0518478a] deSolveDiffEq v0.1.1 [6e34b625] Bzip2_jll v1.0.8+0 [83423d85] Cairo_jll v1.16.1+1