From 1c7f01ec3dbf4db28e6b5bd6fa90bd29a2afcafb Mon Sep 17 00:00:00 2001 From: Samuel Brand Date: Tue, 5 Nov 2024 23:53:34 +0000 Subject: [PATCH 1/4] rm BenchmarkCI and add fork in benchmark.yaml --- .github/workflows/benchmark.yaml | 3 ++- benchmark/Project.toml | 1 - 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/benchmark.yaml b/.github/workflows/benchmark.yaml index 04802aabd..deaa1b523 100644 --- a/.github/workflows/benchmark.yaml +++ b/.github/workflows/benchmark.yaml @@ -24,7 +24,8 @@ jobs: Pkg.rm("EpiAware"); Pkg.resolve(); Pkg.instantiate(); - Pkg.develop(path = "./EpiAware")' + Pkg.develop(path = "./EpiAware"); + Pkg.add(url="https://github.com/SamuelBrand1/BenchmarkCI.jl")' - name: Run benchmarks run: julia --project=benchmark -e 'using BenchmarkCI; BenchmarkCI.judge(; baseline = "origin/main", retune = true)' - name: Post results diff --git a/benchmark/Project.toml b/benchmark/Project.toml index 88dcf30da..13be17133 100644 --- a/benchmark/Project.toml +++ b/benchmark/Project.toml @@ -1,5 +1,4 @@ [deps] -BenchmarkCI = "20533458-34a3-403d-a444-e18f38190b5b" BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf" Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f" DynamicPPL = "366bfd00-2699-11ea-058f-f148b4cae6d8" From 692a0bdef5e39c56c05adc374ffc7f2bcc9e9faf Mon Sep 17 00:00:00 2001 From: Samuel Brand Date: Wed, 6 Nov 2024 00:08:57 +0000 Subject: [PATCH 2/4] reorder benchmark install deps --- .github/workflows/benchmark.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/benchmark.yaml b/.github/workflows/benchmark.yaml index deaa1b523..a427578f1 100644 --- a/.github/workflows/benchmark.yaml +++ b/.github/workflows/benchmark.yaml @@ -22,10 +22,10 @@ jobs: run: | julia --project=benchmark -e 'using Pkg; Pkg.rm("EpiAware"); + Pkg.add(url="https://github.com/SamuelBrand1/BenchmarkCI.jl"); Pkg.resolve(); Pkg.instantiate(); - Pkg.develop(path = "./EpiAware"); - Pkg.add(url="https://github.com/SamuelBrand1/BenchmarkCI.jl")' + Pkg.develop(path = "./EpiAware")' - name: Run benchmarks run: julia --project=benchmark -e 'using BenchmarkCI; BenchmarkCI.judge(; baseline = "origin/main", retune = true)' - name: Post results From fcb2501c0fdbc691206348f927eff637098c4276 Mon Sep 17 00:00:00 2001 From: Samuel Brand Date: Wed, 6 Nov 2024 00:36:29 +0000 Subject: [PATCH 3/4] update ODEProcess benchmark --- benchmark/Project.toml | 1 + .../bench/EpiInfModels/InfectionODEProcess.jl | 24 ------------------- benchmark/bench/EpiInfModels/ODEProcess.jl | 20 ++++++++++++++++ 3 files changed, 21 insertions(+), 24 deletions(-) delete mode 100644 benchmark/bench/EpiInfModels/InfectionODEProcess.jl create mode 100644 benchmark/bench/EpiInfModels/ODEProcess.jl diff --git a/benchmark/Project.toml b/benchmark/Project.toml index 13be17133..0b550876f 100644 --- a/benchmark/Project.toml +++ b/benchmark/Project.toml @@ -3,6 +3,7 @@ BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf" Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f" DynamicPPL = "366bfd00-2699-11ea-058f-f148b4cae6d8" EpiAware = "b2eeebe4-5992-4301-9193-7ebc9f62c855" +OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed" PkgBenchmark = "32113eaa-f34f-5b0d-bd6c-c81e245fc73d" Turing = "fce5fe82-541a-59a6-adf8-730c64b5f9a0" TuringBenchmarking = "0db1332d-5c25-4deb-809f-459bc696f94f" diff --git a/benchmark/bench/EpiInfModels/InfectionODEProcess.jl b/benchmark/bench/EpiInfModels/InfectionODEProcess.jl deleted file mode 100644 index bc0c4b4b1..000000000 --- a/benchmark/bench/EpiInfModels/InfectionODEProcess.jl +++ /dev/null @@ -1,24 +0,0 @@ -let - r = log(2) / 7 # Growth rate corresponding to 7 day doubling time - u0 = [1.0] - p = [r] - params = ODEParams(u0 = u0, p = p) - - # Define the ODE problem using SciML - # We use a simple exponential growth model - - function expgrowth(du, u, p, t) - du[1] = p[1] * u[1] - end - prob = ODEProblem(expgrowth, u0, (0.0, 10.0), p) - - # Define the ODEProcess - - expgrowth_model = ODEProcess(prob::ODEProblem; ts = 0:1:10, - solver = Tsit5(), - sol2infs = sol -> sol[1, :]) - - # Generate the latent infections - I_t = generate_latent_infs(expgrowth_model, params)() - suite["ODEProcess"] = make_epiaware_suite(mdl) -end diff --git a/benchmark/bench/EpiInfModels/ODEProcess.jl b/benchmark/bench/EpiInfModels/ODEProcess.jl new file mode 100644 index 000000000..58997725a --- /dev/null +++ b/benchmark/bench/EpiInfModels/ODEProcess.jl @@ -0,0 +1,20 @@ +let + # Create an instance of SIRParams + sirparams = SIRParams( + tspan = (0.0, 30.0), + infectiousness = LogNormal(log(0.3), 0.05), + recovery_rate = LogNormal(log(0.1), 0.05), + initial_prop_infected = Beta(1, 99) + ) + + # Define the ODEProcess + sir_process = ODEProcess( + params = sirparams, + sol2infs = sol -> sol[2, :], + solver_options = Dict(:verbose => false, :saveat => 1.0) + ) + + # Generate the latent infections + mdl = generate_latent_infs(sir_process, nothing) + suite["ODEProcess"] = make_epiaware_suite(mdl) +end From 0acf90e454151acf0e3547b84d7e4b2cee73d559 Mon Sep 17 00:00:00 2001 From: Samuel Brand Date: Wed, 6 Nov 2024 00:55:21 +0000 Subject: [PATCH 4/4] add SciMLSensitivity This allows reverediff on ODE models --- benchmark/Project.toml | 1 + benchmark/bench/EpiInfModels/EpiInfModels.jl | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/benchmark/Project.toml b/benchmark/Project.toml index 0b550876f..a1238fdb5 100644 --- a/benchmark/Project.toml +++ b/benchmark/Project.toml @@ -5,5 +5,6 @@ DynamicPPL = "366bfd00-2699-11ea-058f-f148b4cae6d8" EpiAware = "b2eeebe4-5992-4301-9193-7ebc9f62c855" OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed" PkgBenchmark = "32113eaa-f34f-5b0d-bd6c-c81e245fc73d" +SciMLSensitivity = "1ed8b502-d754-442c-8d5d-10ac956f44a1" Turing = "fce5fe82-541a-59a6-adf8-730c64b5f9a0" TuringBenchmarking = "0db1332d-5c25-4deb-809f-459bc696f94f" diff --git a/benchmark/bench/EpiInfModels/EpiInfModels.jl b/benchmark/bench/EpiInfModels/EpiInfModels.jl index b07775eda..6e3b77faa 100644 --- a/benchmark/bench/EpiInfModels/EpiInfModels.jl +++ b/benchmark/bench/EpiInfModels/EpiInfModels.jl @@ -1,6 +1,7 @@ module BenchEpiInfModels -using BenchmarkTools, TuringBenchmarking, EpiAware, Distributions, OrdinaryDiffEq +using BenchmarkTools, TuringBenchmarking, EpiAware, Distributions, OrdinaryDiffEq, + SciMLSensitivity suite = BenchmarkGroup() include("../../make_epiaware_suite.jl")