Skip to content

Commit

Permalink
Fix benchmark
Browse files Browse the repository at this point in the history
  • Loading branch information
tansongchen committed Sep 30, 2024
1 parent 58243a8 commit 7ff795b
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 28 deletions.
8 changes: 4 additions & 4 deletions benchmark/benchmarks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ seed!(rng, 19260817)
using Logging
Logging.disable_logging(Logging.Warn)

include("scalar.jl")
include("mlp.jl")
include("taylor_expansion.jl")
include("pinn.jl")
include("groups/scalar.jl")
include("groups/mlp.jl")
include("groups/taylor_expansion.jl")
include("groups/pinn.jl")

scalar = create_benchmark_scalar_function(sin, 0.1)
mlp = create_benchmark_mlp((2, 16), [2.0, 3.0], [1.0, 1.0])
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
36 changes: 12 additions & 24 deletions benchmark/runbenchmarks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,41 +8,29 @@ import JSON: lower, json
using Dates
using HTTP: put

struct BenchmarkContext
datetime::DateTime
commit::String
branch::String
tag::String
end

dict(x) = Dict(name => lower(getfield(x, name)) for name in fieldnames(typeof(x)))

lower(results::BenchmarkResults) = dict(results)
function lower(group::BenchmarkGroup)
Dict(:tags => group.tags,
:data => Dict(key => lower(value) for (key, value) in group.data))
:data => [Dict(lower(value)..., "name" => key) for (key, value) in group.data])
end
lower(trial::Trial) = lower(minimum(trial))
lower(estimate::TrialEstimate) = dict(estimate)
lower(parameters::Parameters) = dict(parameters)
lower(context::BenchmarkContext) = dict(context)

getenv(name::String) = String(strip(ENV[name]))

context = if "BUILDKITE" in keys(ENV)
BenchmarkContext(now(), # datetime
getenv("BUILDKITE_COMMIT"), # commit
getenv("BUILDKITE_BRANCH"), # branch
getenv("BUILDKITE_TAG"))
body = Dict("name" => "TaylorDiff.jl", "datetime" => now())
if "BUILDKITE" in keys(ENV)
body["commit"] = getenv("BUILDKITE_COMMIT")
body["branch"] = getenv("BUILDKITE_BRANCH")
body["tag"] = getenv("BUILDKITE_TAG")
else
BenchmarkContext(now(), "abcdef123456", "dummy", "dummy")
body["commit"] = "abcdef123456"
body["branch"] = "dummy"
end
display(context)

results = benchmarkpkg(TaylorDiff)
(; benchmarkgroup, benchmarkconfig) = results
reconstructed = Dict("context" => context,
"suite" => benchmarkgroup,
"config" => benchmarkconfig)
put("https://benchmark-data.tansongchen.workers.dev/TaylorDiff.jl";
body = json(reconstructed))
(; benchmarkgroup, benchmarkconfig) = benchmarkpkg(TaylorDiff)
body["config"] = benchmarkconfig
body["result"] = lower(benchmarkgroup)[:data]
put("https://benchmark-data.tansongchen.workers.dev"; body = json(body))

0 comments on commit 7ff795b

Please sign in to comment.