euclidean_distance_sir.jl 1.58 KB
 Bentriou Mahmoud committed Feb 22, 2021 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 `````` using Profile using Statistics using BenchmarkTools @everywhere using MarkovProcesses import LinearAlgebra: dot import Distributions: Uniform load_automaton("euclidean_distance_automaton") load_automaton("euclidean_distance_automaton_2") load_model("SIR") tb = 7.0*12 tml_obs = 0:7:tb set_time_bound!(SIR, tb) y_obs = vectorize(simulate(SIR), :I, tml_obs) println("Vectorize:") b_vectorize = @benchmark (σ = simulate(\$(SIR)); euclidean_distance(σ, :I, tml_obs, y_obs)) @btime (σ = simulate(\$(SIR)); euclidean_distance(σ, :I, tml_obs, y_obs)) @show minimum(b_vectorize), mean(b_vectorize), maximum(b_vectorize) println("Automaton with 1 loc") aut1 = create_euclidean_distance_automaton(SIR, tml_obs, y_obs, :I) sync1 = SIR * aut1 b_sim_aut1 = @benchmark (σ = 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))) @show minimum(b_vol_sim_aut1), mean(b_vol_sim_aut1), maximum(b_vol_sim_aut1) `````` Bentriou Mahmoud committed Feb 28, 2021 32 ``````#= `````` Bentriou Mahmoud committed Feb 22, 2021 33 34 35 ``````println("Memory test") Profile.clear_malloc_data() σ = volatile_simulate(sync1) `````` Bentriou Mahmoud committed Feb 28, 2021 36 ``````=# `````` Bentriou Mahmoud committed Feb 22, 2021 37 38 39 40 41 42 43 44 45 46 47 `````` println("Automaton with nbr_obs loc") aut2 = create_euclidean_distance_automaton_2(SIR, tml_obs, y_obs, :I) sync2 = SIR * aut2 b_sim_aut2 = @benchmark (σ = 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))) @show minimum(b_vol_sim_aut2), mean(b_vol_sim_aut2), maximum(b_vol_sim_aut2) ``````