Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .github/workflows/PerformanceCheck.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
name: Performance Check

on:
workflow_dispatch:
pull_request:
branches: [master]
paths-ignore: ['docs/**']

jobs:
build-and-benchmark:
runs-on: ${{ matrix.os }}
Expand Down
29 changes: 0 additions & 29 deletions .github/workflows/benchmark.yml

This file was deleted.

42 changes: 0 additions & 42 deletions benchmark/benchmarks.jl

This file was deleted.

3 changes: 3 additions & 0 deletions benchmarking/CI-scripts/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@ Nemo = "2edaba10-b0f1-5616-af89-8c11ac63239a"
PrettyTables = "08abe8d2-0d0c-5749-adfa-8a2ac140af0d"
Primes = "27ebfcd6-29c5-5fa9-bf4b-fb8fc14df3ae"
TestSetExtensions = "98d24dd4-01ad-11ea-1b02-c9a08f80db04"

[compat]
PrettyTables = "3"
37 changes: 25 additions & 12 deletions benchmarking/CI-scripts/run_benchmarks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,23 @@ stopwatch = time_ns()
# TTFX
t1 = @timed using StructuralIdentifiability

include("../benchmarks.jl")

suite = []

push!(
suite,
(problem_name = "using StructuralIdentifiability", type = :time, result = [t1.time]),
)

# Record the load time before @ODEmodel introduces model parameters such as t1.
include("../benchmarks.jl")

# Allocations
# Coming soon

# Runtime
import Primes
import Nemo
using Logging

function nemo_make_prime_finite_field(p)
return if p < typemax(UInt)
Expand All @@ -47,31 +49,37 @@ function perform_operation(
times = []
for _ in 1:trials
GC.gc()
time = @elapsed fun(ode; kws...)
time = @elapsed fun(ode; loglevel = Logging.Error, kws...)
push!(times, time)
end
return times
end

fun_name = "assess_identifiability"
perform_operation(benchmarks[:LV_simple][:ode])
for m in [:SIWR, :LV_simple, :Pharm]
perform_operation(benchmarks[:LV][:ode])
for (m, trials) in [(:SIWR_orig, 3), (:LV, 30), (:Pharm, 3)]
push!(
suite,
(
problem_name = benchmarks[m][:name] * " " * fun_name,
type = :time,
result = perform_operation(benchmarks[m][:ode]),
result = perform_operation(
benchmarks[m][:ode],
StructuralIdentifiability.assess_identifiability,
trials,
),
),
)
end

fun_name = "assess_local_identifiability"
perform_operation(
benchmarks[:LV_simple][:ode],
benchmarks[:LV][:ode],
StructuralIdentifiability.assess_local_identifiability,
)
for m in [:SIWR, :Pharm, :MAPK5, :MAPK5bis, :Goodwin]
for (m, trials) in [
(:SIWR_orig, 30), (:Pharm, 30), (:MAPK_5out, 3), (:MAPK_5out_bis, 3), (:Goodwin, 30),
]
push!(
suite,
(
Expand All @@ -80,17 +88,20 @@ for m in [:SIWR, :Pharm, :MAPK5, :MAPK5bis, :Goodwin]
result = perform_operation(
benchmarks[m][:ode],
StructuralIdentifiability.assess_local_identifiability,
trials,
),
),
)
end

fun_name = "find_identifiable_functions"
perform_operation(
benchmarks[:LV_simple][:ode],
benchmarks[:LV][:ode],
StructuralIdentifiability.find_identifiable_functions,
)
for m in [:Goodwin, :SEAIJRC, :Sntg, :LLW, :Bilirubin]
for (m, trials) in [
(:Goodwin, 30), (:SEAIJRC, 3), (:St, 3), (:LLW, 30), (:Bilirubin, 30),
]
push!(
suite,
(
Expand All @@ -99,17 +110,18 @@ for m in [:Goodwin, :SEAIJRC, :Sntg, :LLW, :Bilirubin]
result = perform_operation(
benchmarks[m][:ode],
StructuralIdentifiability.find_identifiable_functions,
trials,
),
),
)
end

fun_name = "reparametrize_global"
perform_operation(
benchmarks[:LV_simple][:ode],
benchmarks[:LV][:ode],
StructuralIdentifiability.reparametrize_global,
)
for m in [:Goodwin, :SEAIJRC, :SEUIR]
for (m, trials) in [(:Goodwin, 30), (:SEAIJRC, 3), (:SEUIR, 30)]
push!(
suite,
(
Expand All @@ -118,6 +130,7 @@ for m in [:Goodwin, :SEAIJRC, :SEUIR]
result = perform_operation(
benchmarks[m][:ode],
StructuralIdentifiability.reparametrize_global,
trials,
),
),
)
Expand Down
22 changes: 14 additions & 8 deletions benchmarking/CI-scripts/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -128,13 +128,11 @@ function compare()
master = 1.0e9 .* master
nightly = 1.0e9 .* nightly
f, unit = best_unit(maximum(master))
m1 = round(mean(master) / f, digits = 2)
d1 = round(std(master) / f, digits = 2)
label_master = "$m1 ± $d1 $unit"
m2 = round(mean(nightly) / f, digits = 2)
d2 = round(std(nightly) / f, digits = 2)
label_nightly = "$m2 ± $d2 $unit"
indicator = if mean(master) < 1.0e9 * IGNORE_SMALL
m1 = median(master)
label_master = "$(round(m1 / f, digits = 2)) $unit"
m2 = median(nightly)
label_nightly = "$(round(m2 / f, digits = 2)) $unit"
indicator = if m1 < 1.0e9 * IGNORE_SMALL
0, "insignificant"
elseif (1 + MAX_DEVIATION) * m1 < m2
fail = true
Expand Down Expand Up @@ -170,6 +168,8 @@ function post(fail, table)
comment_header = """
## Running times benchmark

Reported times are medians across all measurements.

Note, that these numbers may fluctuate on the CI servers, so take them with a grain of salt.

"""
Expand All @@ -181,7 +181,13 @@ function post(fail, table)
println(io, "No regressions detected✅")
end
table_header = ["Problem", "Master", "This commit", "Result"]
pretty_table(io, table, header = table_header, alignment = [:l, :r, :r, :r])
pretty_table(
io, table,
column_labels = table_header,
alignment = [:l, :r, :r, :r],
fit_table_in_display_horizontally = false,
fit_table_in_display_vertically = false,
)
comment_str = String(take!(io))
return println(comment_str)
end
Expand Down
Loading