Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
time results
# Time results posted to:
# https://gist.github.com/nmatzke/34ba6b3f8b548af92724bcb3f41bbf3d
#
# ODE problem setup here:
# https://gist.github.com/nmatzke/b6332845747d7452b6e3b45564f460e8
@benchmark sol_CVODE = solve(prob, CVODE_BDF(linear_solver=:GMRES), dense=false, save_everystep=false, save_end=true, save_start=true)
# memory estimate: 2.72 GiB
# allocs estimate: 5711652
# --------------
# minimum time: 1.638 s (16.58% GC)
# median time: 1.707 s (18.34% GC)
# mean time: 1.690 s (17.78% GC)
# maximum time: 1.726 s (18.35% GC)
# --------------
# samples: 3
# evals/sample: 1
@benchmark sol_CVODE2 = solve(prob, CVODE_BDF(), dense=false, save_everystep=false, save_end=true, save_start=true)
# BenchmarkTools.Trial:
# memory estimate: 41.39 GiB
# allocs estimate: 87054243
# --------------
# minimum time: 28.968 s (17.02% GC)
# median time: 28.968 s (17.02% GC)
# mean time: 28.968 s (17.02% GC)
# maximum time: 28.968 s (17.02% GC)
# --------------
# samples: 1
# evals/sample: 1
@benchmark sol_Tsit5 = solve(prob, Tsit5(), dense=false, save_everystep=false, save_end=true, save_start=false)
# memory estimate: 3.29 GiB
# allocs estimate: 6928602
# --------------
# minimum time: 2.158 s (18.41% GC)
# median time: 2.166 s (18.40% GC)
# mean time: 2.166 s (18.41% GC)
# maximum time: 2.174 s (18.33% GC)
# --------------
# samples: 3
# evals/sample: 1
@benchmark sol_Vern9 = solve(prob, Vern9(), dense=false, save_everystep=false, save_end=true, save_start=false)
# memory estimate: 6.43 GiB
# allocs estimate: 13521198
# --------------
# minimum time: 4.155 s (18.08% GC)
# median time: 4.173 s (18.19% GC)
# mean time: 4.173 s (18.19% GC)
# maximum time: 4.190 s (18.31% GC)
# --------------
# samples: 2
# evals/sample: 1
@benchmark sol_Rodas4t = solve(prob, Rodas4(autodiff=true), dense=false, save_everystep=false, save_end=true, save_start=false)
# BenchmarkTools.Trial:
# memory estimate: 205.86 GiB
# allocs estimate: 89694204
# --------------
# minimum time: 100.151 s (22.38% GC)
# median time: 100.151 s (22.38% GC)
# mean time: 100.151 s (22.38% GC)
# maximum time: 100.151 s (22.38% GC)
# --------------
# samples: 1
# evals/sample: 1
@benchmark sol_Rodas4f = solve(prob, Rodas4(autodiff=false), dense=false, save_everystep=false, save_end=true, save_start=false)
# BenchmarkTools.Trial:
# memory estimate: 443.29 GiB
# allocs estimate: 932200421
# --------------
# minimum time: 298.913 s (16.17% GC)
# median time: 298.913 s (16.17% GC)
# mean time: 298.913 s (16.17% GC)
# maximum time: 298.913 s (16.17% GC)
# --------------
# samples: 1
# evals/sample: 1
@benchmark sol_KenCarp4t = solve(prob, KenCarp4(autodiff=true), dense=false, save_everystep=false, save_end=true, save_start=false)
# BenchmarkTools.Trial:
# memory estimate: 121.83 GiB
# allocs estimate: 53371627
# --------------
# minimum time: 63.339 s (22.93% GC)
# median time: 63.339 s (22.93% GC)
# mean time: 63.339 s (22.93% GC)
# maximum time: 63.339 s (22.93% GC)
# --------------
# samples: 1
# evals/sample: 1
@benchmark sol_KenCarp4f = solve(prob, KenCarp4(autodiff=false), dense=false, save_everystep=false, save_end=true, save_start=false)
# BenchmarkTools.Trial:
# memory estimate: 261.87 GiB
# allocs estimate: 550670333
# --------------
# minimum time: 183.348 s (16.62% GC)
# median time: 183.348 s (16.62% GC)
# mean time: 183.348 s (16.62% GC)
# maximum time: 183.348 s (16.62% GC)
# --------------
# samples: 1
# evals/sample: 1
@benchmark sol_default = solve(prob, dense=false, save_everystep=false, save_end=true, save_start=true)
# BenchmarkTools.Trial:
# memory estimate: 3.31 GiB
# allocs estimate: 6928694
# --------------
# minimum time: 2.191 s (17.24% GC)
# median time: 2.222 s (17.46% GC)
# mean time: 2.223 s (18.48% GC)
# maximum time: 2.257 s (20.68% GC)
# --------------
# samples: 3
# evals/sample: 1
@benchmark sol_VCABM = solve(prob, VCABM(), dense=false, save_everystep=false, save_end=true, save_start=false)
# BenchmarkTools.Trial:
# memory estimate: 2.60 GiB
# allocs estimate: 5458983
# --------------
# minimum time: 1.607 s (15.69% GC)
# median time: 1.625 s (16.07% GC)
# mean time: 1.635 s (16.30% GC)
# maximum time: 1.683 s (17.34% GC)
# --------------
# samples: 4
# evals/sample: 1
sol_VCABM = solve(prob, VCABM(), dense=false, save_everystep=false, save_end=true, save_start=false)
# retcode: Success
# Interpolation: 1st order linear
# t: 1-element Array{Float64,1}:
# 1.0
# u: 1-element Array{Array{Float64,1},1}:
# [0.353296, 0.353296, 0.353296, 0.353296, 0.353296, 0.353296, 0.353296, 0.353296, 0.353296, 0.353296 … 8.14137e-5, 8.14137e-5, 8.14137e-5, 8.14137e-5, 8.14137e-5, 8.14137e-5, 8.14137e-5, 8.14137e-5, 8.14137e-5, 8.14137e-5]
@benchmark sol_ROCK4 = solve(prob, ROCK4(), dense=false, save_everystep=false, save_end=true, save_start=false)
# BenchmarkTools.Trial:
# memory estimate: 4.21 GiB
# allocs estimate: 8862987
# --------------
# minimum time: 2.576 s (19.31% GC)
# median time: 2.592 s (19.50% GC)
# mean time: 2.592 s (19.50% GC)
# maximum time: 2.607 s (19.68% GC)
# --------------
# samples: 2
# evals/sample: 1
sol_ROCK4 = solve(prob, ROCK4(), dense=false, save_everystep=false, save_end=true, save_start=false)
# retcode: Success
# Interpolation: 1st order linear
# t: 1-element Array{Float64,1}:
# 1.0
# u: 1-element Array{Array{Float64,1},1}:
# [0.353296, 0.353296, 0.353296, 0.353296, 0.353296, 0.353296, 0.353296, 0.353296, 0.353296, 0.353296 … 8.14155e-5, 8.14155e-5, 8.14155e-5, 8.14155e-5, 8.14155e-5, 8.14155e-5, 8.14155e-5, 8.14155e-5, 8.14155e-5, 8.14155e-5]
@benchmark sol_VCABM3 = solve(prob, VCABM3(), dense=false, save_everystep=false, save_end=true, save_start=false)
# BenchmarkTools.Trial:
# memory estimate: 1.72 GiB
# allocs estimate: 3611377
# --------------
# minimum time: 1.123 s (17.45% GC)
# median time: 1.132 s (17.36% GC)
# mean time: 1.148 s (17.45% GC)
# maximum time: 1.183 s (17.90% GC)
# --------------
# samples: 5
# evals/sample: 1
sol_VCABM3 = solve(prob, VCABM3(), dense=false, save_everystep=false, save_end=true, save_start=false)
# retcode: Success
# Interpolation: 1st order linear
# t: 1-element Array{Float64,1}:
# 1.0
# u: 1-element Array{Array{Float64,1},1}:
# [0.353297, 0.353297, 0.353297, 0.353297, 0.353297, 0.353297, 0.353297, 0.353297, 0.353297, 0.353297 … 8.14132e-5, 8.14132e-5, 8.14132e-5, 8.14132e-5, 8.14132e-5, 8.14132e-5, 8.14132e-5, 8.14132e-5, 8.14132e-5, 8.14132e-5]
@benchmark sol_VCABM4 = solve(prob, VCABM4(), dense=false, save_everystep=false, save_end=true, save_start=false)
# BenchmarkTools.Trial:
# memory estimate: 2.06 GiB
# allocs estimate: 4325243
# --------------
# minimum time: 1.380 s (18.32% GC)
# median time: 1.403 s (18.74% GC)
# mean time: 1.402 s (18.75% GC)
# maximum time: 1.424 s (19.21% GC)
# --------------
# samples: 4
# evals/sample: 1
sol_VCABM4 = solve(prob, VCABM4(), dense=false, save_everystep=false, save_end=true, save_start=false)
# retcode: Success
# Interpolation: 1st order linear
# t: 1-element Array{Float64,1}:
# 1.0
# u: 1-element Array{Array{Float64,1},1}:
# [0.353296, 0.353296, 0.353296, 0.353296, 0.353296, 0.353296, 0.353296, 0.353296, 0.353296, 0.353296 … 8.14135e-5, 8.14135e-5, 8.14135e-5, 8.14135e-5, 8.14135e-5, 8.14135e-5, 8.14135e-5, 8.14135e-5, 8.14135e-5, 8.14135e-5]
@benchmark sol_VCABM5 = solve(prob, VCABM5(), dense=false, save_everystep=false, save_end=true, save_start=false)
# BenchmarkTools.Trial:
# memory estimate: 2.42 GiB
# allocs estimate: 5081046
# --------------
# minimum time: 1.582 s (17.24% GC)
# median time: 1.611 s (17.96% GC)
# mean time: 1.607 s (17.83% GC)
# maximum time: 1.626 s (18.14% GC)
# --------------
# samples: 4
# evals/sample: 1
sol_VCABM5 = solve(prob, VCABM5(), dense=false, save_everystep=false, save_end=true, save_start=false)
# retcode: Success
# Interpolation: 1st order linear
# t: 1-element Array{Float64,1}:
# 1.0
# u: 1-element Array{Array{Float64,1},1}:
# [0.353296, 0.353296, 0.353296, 0.353296, 0.353296, 0.353296, 0.353296, 0.353296, 0.353296, 0.353296 … 8.1426e-5, 8.1426e-5, 8.1426e-5, 8.1426e-5, 8.1426e-5, 8.1426e-5, 8.1426e-5, 8.1426e-5, 8.1426e-5, 8.1426e-5]
@benchmark sol_VCAB3 = solve(prob, VCAB3(), dense=false, save_everystep=false, save_end=true, save_start=false)
# BenchmarkTools.Trial:
# memory estimate: 1.94 GiB
# allocs estimate: 4073323
# --------------
# minimum time: 1.334 s (17.82% GC)
# median time: 1.346 s (18.72% GC)
# mean time: 1.350 s (18.53% GC)
# maximum time: 1.373 s (18.83% GC)
# --------------
# samples: 4
# evals/sample: 1
sol_VCAB3 = solve(prob, VCAB3(), dense=false, save_everystep=false, save_end=true, save_start=false)
# retcode: Success
# Interpolation: 1st order linear
# t: 1-element Array{Float64,1}:
# 1.0
# u: 1-element Array{Array{Float64,1},1}:
# [0.353307, 0.353307, 0.353307, 0.353307, 0.353307, 0.353307, 0.353307, 0.353307, 0.353307, 0.353307 … 8.14092e-5, 8.14092e-5, 8.14092e-5, 8.14092e-5, 8.14092e-5, 8.14092e-5, 8.14092e-5, 8.14092e-5, 8.14092e-5, 8.14092e-5]
@benchmark sol_VCAB4 = solve(prob, VCAB4(), dense=false, save_everystep=false, save_end=true, save_start=false)
# BenchmarkTools.Trial:
# memory estimate: 4.07 GiB
# allocs estimate: 8566471
# --------------
# minimum time: 2.798 s (18.37% GC)
# median time: 2.839 s (18.52% GC)
# mean time: 2.839 s (18.52% GC)
# maximum time: 2.880 s (18.67% GC)
# --------------
# samples: 2
# evals/sample: 1
sol_VCAB4 = solve(prob, VCAB4(), dense=false, save_everystep=false, save_end=true, save_start=false)
# retcode: Success
# Interpolation: 1st order linear
# t: 1-element Array{Float64,1}:
# 1.0
# u: 1-element Array{Array{Float64,1},1}:
# [0.353296, 0.353296, 0.353296, 0.353296, 0.353296, 0.353296, 0.353296, 0.353296, 0.353296, 0.353296 … 8.14136e-5, 8.14136e-5, 8.14136e-5, 8.14136e-5, 8.14136e-5, 8.14136e-5, 8.14136e-5, 8.14136e-5, 8.14136e-5, 8.14136e-5]
@benchmark sol_VCAB5 = solve(prob, VCAB5(), dense=false, save_everystep=false, save_end=true, save_start=false)
# BenchmarkTools.Trial:
# memory estimate: 7.09 GiB
# allocs estimate: 14907265
# --------------
# minimum time: 4.687 s (18.32% GC)
# median time: 4.735 s (18.40% GC)
# mean time: 4.735 s (18.40% GC)
# maximum time: 4.782 s (18.48% GC)
# --------------
# samples: 2
# evals/sample: 1
sol_VCAB5 = solve(prob, VCAB5(), dense=false, save_everystep=false, save_end=true, save_start=false)
# retcode: Success
# Interpolation: 1st order linear
# t: 1-element Array{Float64,1}:
# 1.0
# u: 1-element Array{Array{Float64,1},1}:
# [0.353296, 0.353296, 0.353296, 0.353296, 0.353296, 0.353296, 0.353296, 0.353296, 0.353296, 0.353296 … 8.14123e-5, 8.14123e-5, 8.14123e-5, 8.14123e-5, 8.14123e-5, 8.14123e-5, 8.14123e-5, 8.14123e-5, 8.14123e-5, 8.14123e-5]
@benchmark sol_BS3 = solve(prob, BS3(), dense=false, save_everystep=false, save_end=true, save_start=false)
# BenchmarkTools.Trial:
# memory estimate: 2.28 GiB
# allocs estimate: 4787057
# --------------
# minimum time: 1.485 s (17.66% GC)
# median time: 1.546 s (18.60% GC)
# mean time: 1.532 s (18.50% GC)
# maximum time: 1.551 s (18.47% GC)
# --------------
# samples: 4
# evals/sample: 1
sol_BS3 = solve(prob, BS3(), dense=false, save_everystep=false, save_end=true, save_start=false)
# retcode: Success
# Interpolation: 1st order linear
# t: 1-element Array{Float64,1}:
# 1.0
# u: 1-element Array{Array{Float64,1},1}:
# [0.353296, 0.353296, 0.353296, 0.353296, 0.353296, 0.353296, 0.353296, 0.353296, 0.353296, 0.353296 … 8.1416e-5, 8.1416e-5, 8.1416e-5, 8.1416e-5, 8.1416e-5, 8.1416e-5, 8.1416e-5, 8.1416e-5, 8.1416e-5, 8.1416e-5]
sol_CVODE = solve(prob, CVODE_BDF(linear_solver=:GMRES), dense=false, save_everystep=false, save_end=true, save_start=true)
# [0.353391, 0.353391, 0.353391, 0.353391, 0.353391, 0.353391, 0.353391, 0.353391, 0.353391, 0.353391 … 8.13777e-5, 8.13777e-5, 8.13777e-5, 8.13777e-5, 8.13777e-5, 8.13777e-5, 8.13777e-5, 8.13777e-5, 8.13777e-5, 8.13777e-5]
sol_CVODE = solve(prob, CVODE_BDF(linear_solver=:GMRES), dense=false, save_everystep=false, save_end=true, save_start=true)
# [0.353391, 0.353391, 0.353391, 0.353391, 0.353391, 0.353391, 0.353391, 0.353391, 0.353391, 0.353391 … 8.13777e-5, 8.13777e-5, 8.13777e-5, 8.13777e-5, 8.13777e-5, 8.13777e-5, 8.13777e-5, 8.13777e-5, 8.13777e-5, 8.13777e-5]
sol_CVODE2 = solve(prob, CVODE_BDF(), dense=false, save_everystep=false, save_end=true, save_start=true)
# [0.353306, 0.353306, 0.353306, 0.353306, 0.353306, 0.353306, 0.353306, 0.353306, 0.353306, 0.353306 … 8.54072e-5, 8.54072e-5, 8.54072e-5, 8.54072e-5, 8.54072e-5, 8.54072e-5, 8.54072e-5, 8.54072e-5, 8.54072e-5, 8.54072e-5]
sol_KenCarp4t = solve(prob, KenCarp4(autodiff=true), dense=false, save_everystep=false, save_end=true, save_start=false)
# [0.353294, 0.353294, 0.353294, 0.353294, 0.353294, 0.353294, 0.353294, 0.353294, 0.353294, 0.353294 … 8.14146e-5, 8.14146e-5, 8.14146e-5, 8.14146e-5, 8.14146e-5, 8.14146e-5, 8.14146e-5, 8.14146e-5, 8.14146e-5, 8.14146e-5]
sol_KenCarp4f = solve(prob, KenCarp4(autodiff=false), dense=false, save_everystep=false, save_end=true, save_start=false)
# [0.353294, 0.353294, 0.353294, 0.353294, 0.353294, 0.353294, 0.353294, 0.353294, 0.353294, 0.353294 … 8.14146e-5, 8.14146e-5, 8.14146e-5, 8.14146e-5, 8.14146e-5, 8.14146e-5, 8.14146e-5, 8.14146e-5, 8.14146e-5, 8.14146e-5]
#############################################
# Shorter timespan
#############################################
u = repeat([0.0], 2*n)
du = repeat([0.0], 2*n)
u0 = repeat([0.0], 2*n)
u0[n+1] = 1.0
tspan = (0.0, 0.05)
prob = ODEProblem(BDQ_readable_v5!, u0, tspan, p)
sol_CVODE = solve(prob, CVODE_BDF(linear_solver=:GMRES), dense=false, save_everystep=false, save_end=true, save_start=true)
# [0.0243952, 0.0243952, 0.0243952, 0.0243952, 0.0243952, 0.0243952, 0.0243952, 0.0243952, 0.0243952, 0.0243952 … 0.000162866, 0.000162866, 0.000162866, 0.000162866, 0.000162866, 0.000162866, 0.000162866, 0.000162866, 0.000162866, 0.000162866]
sol_CVODE = solve(prob, CVODE_BDF(linear_solver=:GMRES), dense=false, save_everystep=false, save_end=true, save_start=true)
# [0.0243952, 0.0243952, 0.0243952, 0.0243952, 0.0243952, 0.0243952, 0.0243952, 0.0243952, 0.0243952, 0.0243952 … 0.000162866, 0.000162866, 0.000162866, 0.000162866, 0.000162866, 0.000162866, 0.000162866, 0.000162866, 0.000162866, 0.000162866]
sol_CVODE2 = solve(prob, CVODE_BDF(), dense=false, save_everystep=false, save_end=true, save_start=true)
# [0.024395, 0.024395, 0.024395, 0.024395, 0.024395, 0.024395, 0.024395, 0.024395, 0.024395, 0.024395 … 0.000161524, 0.000161524, 0.000161524, 0.000161524, 0.000161524, 0.000161524, 0.000161524, 0.000161524, 0.000161524, 0.000161524]
sol_KenCarp4t = solve(prob, KenCarp4(autodiff=true), dense=false, save_everystep=false, save_end=true, save_start=false)
# [0.0243952, 0.0243952, 0.0243952, 0.0243952, 0.0243952, 0.0243952, 0.0243952, 0.0243952, 0.0243952, 0.0243952 … 0.000162149, 0.000162149, 0.000162149, 0.000162149, 0.000162149, 0.000162149, 0.000162149, 0.000162149, 0.000162149, 0.000162149]
sol_KenCarp4f = solve(prob, KenCarp4(autodiff=false), dense=false, save_everystep=false, save_end=true, save_start=false)
# [0.0243952, 0.0243952, 0.0243952, 0.0243952, 0.0243952, 0.0243952, 0.0243952, 0.0243952, 0.0243952, 0.0243952 … 0.000162149, 0.000162149, 0.000162149, 0.000162149, 0.000162149, 0.000162149, 0.000162149, 0.000162149, 0.000162149, 0.000162149]
sol_default = solve(prob, dense=false, save_everystep=false, save_end=true, save_start=true)
# retcode: Success
# Interpolation: 1st order linear
# t: 2-element Array{Float64,1}:
# 0.0
# 0.05
# u: 2-element Array{Array{Float64,1},1}:
# [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
# [0.0243952, 0.0243952, 0.0243952, 0.0243952, 0.0243952, 0.0243952, 0.0243952, 0.0243952, 0.0243952, 0.0243952 … 0.000162232, 0.000162232, 0.000162232, 0.000162232, 0.000162232, 0.000162232, 0.000162232, 0.000162232, 0.000162232, 0.000162232]
#######################################################
# See the effect of different timespans on default solve()
#######################################################
u = repeat([0.0], 2*n)
du = repeat([0.0], 2*n)
u0 = repeat([0.0], 2*n)
u0[n+1] = 1.0
tspan = (0.0, 0.01)
prob0 = ODEProblem(BDQ_readable_v5!, u0, tspan, p)
@benchmark sol_default0 = solve(prob0, dense=false, save_everystep=false, save_end=true, save_start=true)
# BenchmarkTools.Trial:
# memory estimate: 567.58 MiB
# allocs estimate: 1133936
# --------------
# minimum time: 327.727 ms (14.45% GC)
# median time: 337.443 ms (15.09% GC)
# mean time: 373.264 ms (23.83% GC)
# maximum time: 512.791 ms (44.97% GC)
# --------------
# samples: 14
# evals/sample: 1
sol_default0 = solve(prob0, dense=false, save_everystep=false, save_end=true, save_start=true)
# Interpolation: 1st order linear
# t: 2-element Array{Float64,1}:
# 0.0
# 0.01
# u: 2-element Array{Array{Float64,1},1}:
# [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
# [0.00497517, 0.00497517, 0.00497517, 0.00497517, 0.00497517, 0.00497517, 0.00497517, 0.00497517, 0.00497517, 0.00497517 … 7.61894e-5, 7.61894e-5, 7.61894e-5, 7.61894e-5, 7.61894e-5, 7.61894e-5, 7.61894e-5, 7.61894e-5, 7.61894e-5, 7.61894e-5]
u = repeat([0.0], 2*n)
du = repeat([0.0], 2*n)
u0 = repeat([0.0], 2*n)
u0[n+1] = 1.0
tspan = (0.0, 0.1)
prob1 = ODEProblem(BDQ_readable_v5!, u0, tspan, p)
@benchmark sol_default1 = solve(prob1, dense=false, save_everystep=false, save_end=true, save_start=true)
# BenchmarkTools.Trial:
# memory estimate: 1.03 GiB
# allocs estimate: 2141720
# --------------
# minimum time: 659.571 ms (16.59% GC)
# median time: 690.379 ms (17.60% GC)
# mean time: 704.083 ms (20.17% GC)
# maximum time: 777.784 ms (27.68% GC)
# --------------
# samples: 8
# evals/sample: 1
sol_default1 = solve(prob1, dense=false, save_everystep=false, save_end=true, save_start=true)
# retcode: Success
# Interpolation: 1st order linear
# t: 2-element Array{Float64,1}:
# 0.0
# 0.1
# u: 2-element Array{Array{Float64,1},1}:
# [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
# [0.0476569, 0.0476569, 0.0476569, 0.0476569, 0.0476569, 0.0476569, 0.0476569, 0.0476569, 0.0476569, 0.0476569 … 0.000164531, 0.000164531, 0.000164531, 0.000164531, 0.000164531, 0.000164531, 0.000164531, 0.000164531, 0.000164531, 0.000164531]
u = repeat([0.0], 2*n)
du = repeat([0.0], 2*n)
u0 = repeat([0.0], 2*n)
u0[n+1] = 1.0
tspan = (0.0, 1.0)
prob2 = ODEProblem(BDQ_readable_v5!, u0, tspan, p)
@benchmark sol_default2 = solve(prob2, dense=false, save_everystep=false, save_end=true, save_start=true)
# BenchmarkTools.Trial:
# memory estimate: 3.31 GiB
# allocs estimate: 6928694
# --------------
# minimum time: 2.169 s (15.64% GC)
# median time: 2.207 s (15.61% GC)
# mean time: 2.206 s (16.33% GC)
# maximum time: 2.241 s (17.72% GC)
# --------------
# samples: 3
# evals/sample: 1
sol_default2 = solve(prob2, dense=false, save_everystep=false, save_end=true, save_start=true)
# retcode: Success
# Interpolation: 1st order linear
# t: 2-element Array{Float64,1}:
# 0.0
# 1.0
# u: 2-element Array{Array{Float64,1},1}:
# [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
# [0.353296, 0.353296, 0.353296, 0.353296, 0.353296, 0.353296, 0.353296, 0.353296, 0.353296, 0.353296 … 8.14129e-5, 8.14129e-5, 8.14129e-5, 8.14129e-5, 8.14129e-5, 8.14129e-5, 8.14129e-5, 8.14129e-5, 8.14129e-5, 8.14129e-5]
u = repeat([0.0], 2*n)
du = repeat([0.0], 2*n)
u0 = repeat([0.0], 2*n)
u0[n+1] = 1.0
tspan = (0.0, 10.0)
prob3 = ODEProblem(BDQ_readable_v5!, u0, tspan, p)
@benchmark sol_default3 = solve(prob3, dense=false, save_everystep=false, save_end=true, save_start=true)
# FAILED WITH ERRORS:
# ┌ Warning: dt <= dtmin. Aborting. There is either an error in your model specification or the true solution is unstable.
# └ @ DiffEqBase ~/.julia/packages/DiffEqBase/ZQVwI/src/integrator_interface.jl:156
########################################################
# Try different timespans on CVODE_BDF
########################################################
u = repeat([0.0], 2*n)
du = repeat([0.0], 2*n)
u0 = repeat([0.0], 2*n)
u0[n+1] = 1.0
tspan = (0.0, 0.1)
prob0 = ODEProblem(BDQ_readable_v5!, u0, tspan, p)
@benchmark sol_CVODE1 = solve(prob1, CVODE_BDF(linear_solver=:GMRES), dense=false, save_everystep=false, save_end=true, save_start=true)
# BenchmarkTools.Trial:
# memory estimate: 1.54 GiB
# allocs estimate: 3233831
# --------------
# minimum time: 994.524 ms (15.34% GC)
# median time: 1.012 s (15.55% GC)
# mean time: 1.009 s (15.62% GC)
# maximum time: 1.031 s (16.12% GC)
# --------------
# samples: 5
# evals/sample: 1
sol_CVODE1 = solve(prob1, CVODE_BDF(linear_solver=:GMRES), dense=false, save_everystep=false, save_end=true, save_start=true)
# retcode: Success
# Interpolation: 1st order linear
# t: 2-element Array{Float64,1}:
# 0.0
# 0.1
# u: 2-element Array{Array{Float64,1},1}:
# [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
# [0.0476569, 0.0476569, 0.0476569, 0.0476569, 0.0476569, 0.0476569, 0.0476569, 0.0476569, 0.0476569, 0.0476569 … 0.000164621, 0.000164621, 0.000164621, 0.000164621, 0.000164621, 0.000164621, 0.000164621, 0.000164621, 0.000164621, 0.000164621]
u = repeat([0.0], 2*n)
du = repeat([0.0], 2*n)
u0 = repeat([0.0], 2*n)
u0[n+1] = 1.0
tspan = (0.0, 0.01)
prob0 = ODEProblem(BDQ_readable_v5!, u0, tspan, p)
@benchmark sol_CVODE0 = solve(prob0, CVODE_BDF(linear_solver=:GMRES), dense=false, save_everystep=false, save_end=true, save_start=true)
# BenchmarkTools.Trial:
# memory estimate: 347.65 MiB
# allocs estimate: 714051
# --------------
# minimum time: 221.338 ms (15.99% GC)
# median time: 225.105 ms (15.70% GC)
# mean time: 226.095 ms (15.54% GC)
# maximum time: 233.299 ms (15.63% GC)
# --------------
# samples: 23
# evals/sample: 1
sol_CVODE0 = solve(prob0, CVODE_BDF(linear_solver=:GMRES), dense=false, save_everystep=false, save_end=true, save_start=true)
# retcode: Success
# Interpolation: 1st order linear
# t: 2-element Array{Float64,1}:
# 0.0
# 0.01
# u: 2-element Array{Array{Float64,1},1}:
# [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
# [0.00497511, 0.00497511, 0.00497511, 0.00497511, 0.00497511, 0.00497511, 0.00497511, 0.00497511, 0.00497511, 0.00497511 … 7.65838e-5, 7.65838e-5, 7.65838e-5, 7.65838e-5, 7.65838e-5, 7.65838e-5, 7.65838e-5, 7.65838e-5, 7.65838e-5, 7.65838e-5]
########################################################
# Try different timespans on VCABM
########################################################
u = repeat([0.0], 2*n)
du = repeat([0.0], 2*n)
u0 = repeat([0.0], 2*n)
u0[n+1] = 1.0
tspan = (0.0, 0.1)
prob0 = ODEProblem(BDQ_readable_v5!, u0, tspan, p)
@benchmark sol_VCABM1 = solve(prob1, VCABM(), dense=false, save_everystep=false, save_end=true, save_start=true)
# BenchmarkTools.Trial:
# memory estimate: 695.77 MiB
# allocs estimate: 1427852
# --------------
# minimum time: 419.746 ms (15.17% GC)
# median time: 439.420 ms (16.55% GC)
# mean time: 435.199 ms (16.42% GC)
# maximum time: 445.218 ms (17.26% GC)
# --------------
# samples: 12
# evals/sample: 1
sol_VCABM1 = solve(prob1, VCABM(), dense=false, save_everystep=false, save_end=true, save_start=true)
# retcode: Success
# Interpolation: 1st order linear
# t: 2-element Array{Float64,1}:
# 0.0
# 0.1
# u: 2-element Array{Array{Float64,1},1}:
# [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
# [0.0476569, 0.0476569, 0.0476569, 0.0476569, 0.0476569, 0.0476569, 0.0476569, 0.0476569, 0.0476569, 0.0476569 … 0.00016458, 0.00016458, 0.00016458, 0.00016458, 0.00016458, 0.00016458, 0.00016458, 0.00016458, 0.00016458, 0.00016458]
u = repeat([0.0], 2*n)
du = repeat([0.0], 2*n)
u0 = repeat([0.0], 2*n)
u0[n+1] = 1.0
tspan = (0.0, 0.01)
prob0 = ODEProblem(BDQ_readable_v5!, u0, tspan, p)
@benchmark sol_VCABM0 = solve(prob0, VCABM(), dense=false, save_everystep=false, save_end=true, save_start=true)
# BenchmarkTools.Trial:
# memory estimate: 389.07 MiB
# allocs estimate: 797987
# --------------
# minimum time: 232.076 ms (14.59% GC)
# median time: 247.270 ms (16.56% GC)
# mean time: 245.690 ms (16.44% GC)
# maximum time: 252.400 ms (17.28% GC)
# --------------
# samples: 21
# evals/sample: 1
sol_VCABM0 = solve(prob0, VCABM(), dense=false, save_everystep=false, save_end=true, save_start=true)
# retcode: Success
# Interpolation: 1st order linear
# t: 2-element Array{Float64,1}:
# 0.0
# 0.01
# u: 2-element Array{Array{Float64,1},1}:
# [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
# [0.00497517, 0.00497517, 0.00497517, 0.00497517, 0.00497517, 0.00497517, 0.00497517, 0.00497517, 0.00497517, 0.00497517 … 7.6145e-5, 7.6145e-5, 7.6145e-5, 7.6145e-5, 7.6145e-5, 7.6145e-5, 7.6145e-5, 7.6145e-5, 7.6145e-5, 7.6145e-
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.