Skip to content

Commit

Permalink
Issue 274: Add continuous benchmark structure (#298)
Browse files Browse the repository at this point in the history
* add benchmark workflow

* make sure to install benchmark deps

* add benchmark folder

* add infracstructure to run benchmarks

* add a proposed structure for future benchmarks

* fix action indexing

* tweak action for detection of local EpiAware

* tweak action for detection of local EpiAware

* add benchmark run

* move benchmarks to the top level and wrap everything in a utility package

* add in subdirectory builds

* Update benchmark.yaml

* Update benchmark.yaml

* Update benchmark.yaml

* Update benchmark.yaml

* Update benchmark.yaml

* Update benchmark.yaml

* Update benchmark.yaml

* Update Rtwithoutrenewal.jl

* Update benchmark.yaml

* Update benchmark.yaml

* Update benchmark.yaml

* Update Project.toml

* Update benchmark.yaml

* Update benchmark.yaml

* Update benchmark.yaml
  • Loading branch information
seabbs authored Jun 21, 2024
1 parent 18f8aec commit 8166227
Show file tree
Hide file tree
Showing 10 changed files with 102 additions and 0 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/benchmark.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Run benchmarks

on:
pull_request:
paths:
- 'EpiAware/**'
merge_group:
paths:
- 'EpiAware/**'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
Benchmark:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v1
- uses: julia-actions/cache@v1
- name: Install dependencies
run: |
julia --project=benchmark -e 'using Pkg;
Pkg.rm("EpiAware");
Pkg.rm("EpiAwarePipeline");
Pkg.resolve();
Pkg.instantiate();
Pkg.develop(path = "./EpiAware");
Pkg.develop(path = "./pipeline")'
- name: Run benchmarks
run: julia --project=benchmark -e 'using BenchmarkCI; BenchmarkCI.judge(; baseline = "origin/main")'
- name: Post results
run: julia --project=benchmark -e 'using BenchmarkCI; BenchmarkCI.postjudge()'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -385,3 +385,7 @@ docs/site/

#Ignore generated Pluto notebooks
EpiAware/docs/src/examples/*.md

# benchmark ignore
/.benchmarkci
/benchmark/*.json
4 changes: 4 additions & 0 deletions EpiAware/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,7 @@ docs/build
*.zip

.DS_Store

# benchmark ignore
/.benchmarkci
/benchmark/*.json
8 changes: 8 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
name = "Rtwithoutrenewal"
uuid = "5f18122a-2e46-11ef-2c26-2d57cbc8fe48"
authors = ["Samuel Abbott <[email protected]>", "Samuel Brand <[email protected]>", "Zachary Susswein <[email protected]>"]
version = "0.1.0-DEV"

[deps]
EpiAware = "b2eeebe4-5992-4301-9193-7ebc9f62c855"
EpiAwarePipeline = "66314692-3678-4cbb-b3ac-6fcb54505317"
7 changes: 7 additions & 0 deletions benchmark/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[deps]
BenchmarkCI = "20533458-34a3-403d-a444-e18f38190b5b"
BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
EpiAware = "b2eeebe4-5992-4301-9193-7ebc9f62c855"
EpiAwarePipeline = "66314692-3678-4cbb-b3ac-6fcb54505317"
PkgBenchmark = "32113eaa-f34f-5b0d-bd6c-c81e245fc73d"
10 changes: 10 additions & 0 deletions benchmark/bench/EpiAwareUtils/EpiAwareUtils.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module BenchEpiAwareUtils

using BenchmarkTools, EpiAware

suite = BenchmarkGroup()

include("censored_pmf.jl")

end
BenchEpiAwareUtils.suite
5 changes: 5 additions & 0 deletions benchmark/bench/EpiAwareUtils/censored_pmf.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
let
using Distributions
dist = Exponential(1.0)
suite["censored_pmf"] = @benchmarkable(censored_pmf($dist, Δd = 1.0, D = 3.0))
end
11 changes: 11 additions & 0 deletions benchmark/benchmarks.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using BenchmarkTools
SUITE = BenchmarkGroup()
for folder in readdir(joinpath(@__DIR__, "bench"))
if isdir(joinpath(@__DIR__, "bench", folder))
suite_name = basename(folder)
suite_file = joinpath(@__DIR__, "bench", folder, "$suite_name.jl")
if isfile(suite_file)
SUITE[suite_name] = include(suite_file)
end
end
end
11 changes: 11 additions & 0 deletions benchmark/runbenchmarks.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using PkgBenchmark
benchmarkpkg(
dirname(@__DIR__),
BenchmarkConfig(
env = Dict(
"JULIA_NUM_THREADS" => "1",
"OMP_NUM_THREADS" => "1"
),
),
resultfile = joinpath(@__DIR__, "result.json")
)
6 changes: 6 additions & 0 deletions src/Rtwithoutrenewal.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module Rtwithoutrenewal

using EpiAware
using EpiAwarePipeline

end

0 comments on commit 8166227

Please sign in to comment.