-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
52 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,23 @@ | ||
using BenchmarkTools | ||
using TestItemRunner | ||
|
||
const SUITE = BenchmarkGroup() | ||
function run_scenario(scenario, complexity) | ||
scenario_filter(i) = occursin(string(scenario), i.filename) && complexity ∈ i.tags | ||
@run_package_tests filter=scenario_filter | ||
end | ||
|
||
SUITE["AlSiO2H"] = BenchmarkGroup() | ||
SUITE["AlSiO2H"] = @benchmarkable @run_package_tests filter=(i->occursin("AlSiO2H.jl", i.filename) && | ||
:debug ∈ i.tags) | ||
all_scenarios() = [:AlSiO2H, :Cr19, :Fe2MnAl, :Mn2RuGa, :WFe] | ||
function make_suite(; scenarios=all_scenarios(), complexity=:debug) | ||
@assert complexity ∈ [:debug, :small, :full] | ||
@assert all(scenarios .∈ Ref(all_scenarios())) | ||
|
||
suite = BenchmarkGroup() | ||
|
||
for scenario in scenarios | ||
suite[scenario] = BenchmarkGroup() | ||
suite[scenario] = @benchmarkable run_scenario($scenario, $complexity) | ||
end | ||
suite | ||
end | ||
|
||
const SUITE = make_suite(; scenarios=[:AlSiO2H]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,43 @@ | ||
ROOTPATH = joinpath(@__DIR__, "../..") | ||
ROOTPATH = abspath(joinpath(@__DIR__, "../..")) | ||
import Pkg | ||
Pkg.activate(@__DIR__) | ||
if !isfile(joinpath(@__DIR__, "Manifest.toml")) | ||
Pkg.develop(Pkg.PackageSpec(; path=ROOTPATH)) | ||
Pkg.instantiate() | ||
end | ||
|
||
using BenchmarkCI | ||
|
||
import BenchmarkCI | ||
import LibGit2 | ||
repo = mktempdir(mktempdir()) # TestItemRunner needs access to parent directory as well. | ||
LibGit2.clone("https://github.com/epolack/DFTK-testproblems", repo) | ||
|
||
# Workaround to be able to benchmark releases before the use of PkgBenchmark. | ||
script = tempname(repo) * ".jl" | ||
benchpath = joinpath(ROOTPATH, "benchmark", "humongous", "benchmarks.jl") | ||
project = dirname(benchpath) | ||
cp(benchpath, script) | ||
""" | ||
Launch with | ||
```julia | ||
julia --project=benchmark/humongous -e ' | ||
include("benchmark/humongous/run.jl") | ||
run_benchmark()' | ||
``` | ||
""" | ||
function run_benchmark(; retune=false, baseline="origin/master", target="HEAD", | ||
script=nothing) | ||
mktempdir(mktempdir()) do repo_dir # TestItemRunner needs access to parent directory as well. | ||
project = joinpath(ROOTPATH, "benchmark", "humongous") | ||
# Workaround to be able to benchmark releases before the use of PkgBenchmark. | ||
# WARN: In this case, we need PkgBenchmark to be installed globally. | ||
if isnothing(script) | ||
# We run the default benchmark. | ||
script = joinpath(project, "benchmarks.jl") | ||
else | ||
occursin(ROOTPATH, abspath(script)) && | ||
error("Script should be outside the repository.") | ||
end | ||
script_copy = joinpath(repo_dir, "benchmarks.jl") | ||
cp(script, script_copy) | ||
|
||
LibGit2.clone("https://github.com/epolack/DFTK-testproblems", | ||
joinpath(repo_dir, "test")) | ||
|
||
BenchmarkCI.judge(; retune=true, script, project) | ||
BenchmarkCI.judge(; baseline, target, retune, script=script_copy, project) | ||
|
||
BenchmarkCI.displayjudgement() | ||
BenchmarkCI.displayjudgement() | ||
end | ||
end |