diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml new file mode 100644 index 000000000..a7303b11a --- /dev/null +++ b/.github/workflows/benchmark.yml @@ -0,0 +1,29 @@ +name: Benchmark this PR + +on: + pull_request: + branches: [master] + paths-ignore: ['docs/**'] + +permissions: + pull-requests: write + contents: read + +jobs: + benchmark: + runs-on: ubuntu-latest + timeout-minutes: 60 + strategy: + fail-fast: false + matrix: + version: ["1", "lts"] + env: + # Force consistent Julia depot path for self-hosted runners + JULIA_DEPOT_PATH: ~/.julia + steps: + - uses: MilesCranmer/AirspeedVelocity.jl@action-v1 + with: + julia-version: ${{ matrix.version }} + script: "benchmark/benchmarks.jl" + extra-pkgs: "" + job-summary: true diff --git a/benchmark/benchmarks.jl b/benchmark/benchmarks.jl new file mode 100644 index 000000000..a9fd5eb02 --- /dev/null +++ b/benchmark/benchmarks.jl @@ -0,0 +1,42 @@ +using StructuralIdentifiability, BenchmarkTools + +const SUITE = BenchmarkGroup() + +# ============================================================================= +# Model construction — linear compartment models +# ============================================================================= + +SUITE["construction"] = BenchmarkGroup() + +graph3 = [[2], [1, 3], [1, 2]] +graph4 = [[2, 4], [1, 3], [2, 4], [1, 3]] + +SUITE["construction"]["lincomp_3"] = @benchmarkable linear_compartment_model( + $graph3; inputs = [1], outputs = [1], leaks = [] +) +SUITE["construction"]["lincomp_4"] = @benchmarkable linear_compartment_model( + $graph4; inputs = [2], outputs = [1], leaks = [2, 3] +) + +# ============================================================================= +# Identifiability assessment — the core workload: differential algebra + +# rational function field computation +# ============================================================================= + +SUITE["identifiability"] = BenchmarkGroup() + +ode3 = linear_compartment_model(graph3; inputs = [1], outputs = [1]) +ode4 = linear_compartment_model(graph4; inputs = [2], outputs = [1], leaks = [2, 3]) + +SUITE["identifiability"]["local_3"] = @benchmarkable assess_local_identifiability($ode3) +SUITE["identifiability"]["local_4"] = @benchmarkable assess_local_identifiability($ode4) +SUITE["identifiability"]["global_3"] = @benchmarkable assess_identifiability($ode3) seconds = 600 + +# ============================================================================= +# IO-equation derivation and identifiable function extraction +# ============================================================================= + +SUITE["ioequations"] = BenchmarkGroup() + +SUITE["ioequations"]["find_3"] = @benchmarkable find_ioequations($ode3) +SUITE["ioequations"]["find_4"] = @benchmarkable find_ioequations($ode4)