Skip to content
Snippets Groups Projects
Commit 9cbfdc4a authored by Bentriou Mahmoud's avatar Bentriou Mahmoud
Browse files

rewrite of some benchmark

parent 687595ff
No related branches found
No related tags found
No related merge requests found
...@@ -21,37 +21,33 @@ b_vectorize = @benchmark begin ...@@ -21,37 +21,33 @@ b_vectorize = @benchmark begin
σ = simulate($(repressilator)) σ = simulate($(repressilator))
euclidean_distance(σ, :P1, tml_obs, y_obs) euclidean_distance(σ, :P1, tml_obs, y_obs)
end end
#=
@btime begin @btime begin
σ = simulate($(repressilator)) σ = simulate($(repressilator))
euclidean_distance(σ, :P1, tml_obs, y_obs) euclidean_distance(σ, :P1, tml_obs, y_obs)
end end
=#
@show minimum(b_vectorize), mean(b_vectorize), maximum(b_vectorize) @show minimum(b_vectorize), mean(b_vectorize), maximum(b_vectorize)
println("Automaton with 1 loc") println("Automaton with 1 loc")
aut1 = create_euclidean_distance_automaton(repressilator, tml_obs, y_obs, :P1) aut1 = create_euclidean_distance_automaton(repressilator, tml_obs, y_obs, :P1)
sync1 = repressilator * aut1 sync1 = repressilator * aut1
b_sim_aut1 = @benchmark (σ = simulate($(sync1))) b_sim_aut1 = @benchmark (σ = simulate($(sync1)))
@btime (σ = simulate($(sync1))) #@btime (σ = simulate($(sync1)))
@show minimum(b_sim_aut1), mean(b_sim_aut1), maximum(b_sim_aut1) @show minimum(b_sim_aut1), mean(b_sim_aut1), maximum(b_sim_aut1)
b_vol_sim_aut1 = @benchmark (σ = volatile_simulate($(sync1))) b_vol_sim_aut1 = @benchmark (σ = volatile_simulate($(sync1)))
@btime (σ = volatile_simulate($(sync1))) #@btime (σ = volatile_simulate($(sync1)))
@show minimum(b_vol_sim_aut1), mean(b_vol_sim_aut1), maximum(b_vol_sim_aut1) @show minimum(b_vol_sim_aut1), mean(b_vol_sim_aut1), maximum(b_vol_sim_aut1)
println("ABC reject automaton with 1 loc") println("ABC reject automaton with 1 loc")
aut1_abc = create_abc_euclidean_distance_automaton(repressilator, tml_obs, y_obs, :P1) aut1_abc = create_abc_euclidean_distance_automaton(repressilator, tml_obs, y_obs, :P1)
aut1_abc.ϵ = Inf aut1_abc.ϵ = Inf
sync1_abc = repressilator * aut1_abc sync1_abc = repressilator * aut1_abc
println("After creating sync model")
@show aut1_abc.ϵ
b_sim_aut1_abc = @benchmark (σ = simulate($(sync1_abc))) b_sim_aut1_abc = @benchmark (σ = simulate($(sync1_abc)))
@btime (σ = simulate($(sync1_abc))) #@btime (σ = simulate($(sync1_abc)))
println("After bench simulate sync model")
@show aut1_abc.ϵ
@show minimum(b_sim_aut1_abc), mean(b_sim_aut1_abc), maximum(b_sim_aut1_abc) @show minimum(b_sim_aut1_abc), mean(b_sim_aut1_abc), maximum(b_sim_aut1_abc)
b_vol_sim_aut1_abc = @benchmark (σ = volatile_simulate($(sync1_abc))) b_vol_sim_aut1_abc = @benchmark (σ = volatile_simulate($(sync1_abc)))
@btime (σ = volatile_simulate($(sync1_abc))) #@btime (σ = volatile_simulate($(sync1_abc)))
println("After bench volatile_simulate sync model")
@show aut1_abc.ϵ
@show minimum(b_vol_sim_aut1_abc), mean(b_vol_sim_aut1_abc), maximum(b_vol_sim_aut1_abc) @show minimum(b_vol_sim_aut1_abc), mean(b_vol_sim_aut1_abc), maximum(b_vol_sim_aut1_abc)
#= #=
...@@ -65,9 +61,9 @@ println("Automaton with nbr_obs loc") ...@@ -65,9 +61,9 @@ println("Automaton with nbr_obs loc")
aut2 = create_euclidean_distance_automaton_2(repressilator, tml_obs, y_obs, :P1) aut2 = create_euclidean_distance_automaton_2(repressilator, tml_obs, y_obs, :P1)
sync2 = repressilator * aut2 sync2 = repressilator * aut2
b_sim_aut2 = @benchmark (σ = simulate($(sync2))) b_sim_aut2 = @benchmark (σ = simulate($(sync2)))
@btime (σ = simulate($(sync2))) #@btime (σ = simulate($(sync2)))
@show minimum(b_sim_aut2), mean(b_sim_aut2), maximum(b_sim_aut2) @show minimum(b_sim_aut2), mean(b_sim_aut2), maximum(b_sim_aut2)
b_vol_sim_aut2 = @benchmark (σ = volatile_simulate($(sync2))) b_vol_sim_aut2 = @benchmark (σ = volatile_simulate($(sync2)))
@btime (σ = volatile_simulate($(sync2))) #@btime (σ = volatile_simulate($(sync2)))
@show minimum(b_vol_sim_aut2), mean(b_vol_sim_aut2), maximum(b_vol_sim_aut2) @show minimum(b_vol_sim_aut2), mean(b_vol_sim_aut2), maximum(b_vol_sim_aut2)
...@@ -5,14 +5,26 @@ using MarkovProcesses ...@@ -5,14 +5,26 @@ using MarkovProcesses
import LinearAlgebra: dot import LinearAlgebra: dot
import Distributions: Uniform import Distributions: Uniform
load_automaton("euclidean_distance_automaton")
load_model("repressilator") load_model("repressilator")
tb = 210.0 observe_all!(repressilator)
tml_obs = 0:10.0:210.0 N_periods, ref_mean_tp = 8, 20.0
set_param!(repressilator, [:α, :β, :n, :α0], [200.0, 2.0, 2.0, 0.0]) set_param!(repressilator, [:α, :β, :n, :α0], [200.0, 2.0, 2.0, 0.0])
set_time_bound!(repressilator, tb) set_time_bound!(repressilator, (N_periods)*ref_mean_tp)
b_sim = @benchmark σ = simulate($(repressilator)) b_sim = @benchmark σ = simulate($(repressilator))
@btime σ = simulate($(repressilator)) @show mean(b_sim)
@show mean(b_sim).time, mean(b_sim).memory @show mean(b_sim).time, mean(b_sim).memory
load_automaton("period_automaton")
L, H = 20.0, 100.0
A_per = create_period_automaton(repressilator, L, H, N_periods, :P1; ref_mean_tp = ref_mean_tp, error_func = :max_mean_var_relative_error)
sync_repressilator = repressilator * A_per
b_period = @benchmark σ = simulate($(sync_repressilator))
@show mean(b_period)
@show mean(b_period).time, mean(b_period).memory
b_vol_period = @benchmark σ = volatile_simulate($(sync_repressilator))
@show mean(b_vol_period)
@show mean(b_vol_period).time, mean(b_vol_period).memory
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment