From 9cbfdc4a6f45d874226a66e866efc2dbb038e328 Mon Sep 17 00:00:00 2001 From: Mahmoud Bentriou <mahmoud.bentriou@centralesupelec.fr> Date: Wed, 17 Mar 2021 15:44:00 +0100 Subject: [PATCH] rewrite of some benchmark --- bench/pkg/euclidean_distance_repressilator.jl | 20 +++++++---------- bench/pkg/sim_repressilator.jl | 22 ++++++++++++++----- 2 files changed, 25 insertions(+), 17 deletions(-) diff --git a/bench/pkg/euclidean_distance_repressilator.jl b/bench/pkg/euclidean_distance_repressilator.jl index 7be49b5..581e3ec 100644 --- a/bench/pkg/euclidean_distance_repressilator.jl +++ b/bench/pkg/euclidean_distance_repressilator.jl @@ -21,37 +21,33 @@ b_vectorize = @benchmark begin σ = simulate($(repressilator)) euclidean_distance(σ, :P1, tml_obs, y_obs) end +#= @btime begin σ = simulate($(repressilator)) euclidean_distance(σ, :P1, tml_obs, y_obs) end +=# @show minimum(b_vectorize), mean(b_vectorize), maximum(b_vectorize) println("Automaton with 1 loc") aut1 = create_euclidean_distance_automaton(repressilator, tml_obs, y_obs, :P1) sync1 = repressilator * aut1 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) 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) println("ABC reject automaton with 1 loc") aut1_abc = create_abc_euclidean_distance_automaton(repressilator, tml_obs, y_obs, :P1) aut1_abc.ϵ = Inf sync1_abc = repressilator * aut1_abc -println("After creating sync model") -@show aut1_abc.ϵ b_sim_aut1_abc = @benchmark (σ = simulate($(sync1_abc))) -@btime (σ = simulate($(sync1_abc))) -println("After bench simulate sync model") -@show aut1_abc.ϵ +#@btime (σ = simulate($(sync1_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))) -@btime (σ = volatile_simulate($(sync1_abc))) -println("After bench volatile_simulate sync model") -@show aut1_abc.ϵ +#@btime (σ = volatile_simulate($(sync1_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") aut2 = create_euclidean_distance_automaton_2(repressilator, tml_obs, y_obs, :P1) sync2 = repressilator * aut2 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) 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) diff --git a/bench/pkg/sim_repressilator.jl b/bench/pkg/sim_repressilator.jl index 56fa166..3028d8f 100644 --- a/bench/pkg/sim_repressilator.jl +++ b/bench/pkg/sim_repressilator.jl @@ -5,14 +5,26 @@ using MarkovProcesses import LinearAlgebra: dot import Distributions: Uniform -load_automaton("euclidean_distance_automaton") load_model("repressilator") -tb = 210.0 -tml_obs = 0:10.0:210.0 +observe_all!(repressilator) +N_periods, ref_mean_tp = 8, 20.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)) -@btime σ = simulate($(repressilator)) +@show mean(b_sim) @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 + -- GitLab