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 7b36910
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 26 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.
34 changes: 12 additions & 22 deletions benchmark/runbenchmarks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,12 @@ 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(value..., "name" => key) for (key, value) in group.data])
end
lower(trial::Trial) = lower(minimum(trial))
lower(estimate::TrialEstimate) = dict(estimate)
Expand All @@ -29,20 +22,17 @@ 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("owner" => "JuliaDiff", "repo" => "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"] = benchmarkgroup
put("https://benchmark-data.tansongchen.workers.dev"; body = json(body))

0 comments on commit 7b36910

Please sign in to comment.