Skip to content

Commit 49ba939

Browse files
committed
external humongous run
1 parent 0dade6b commit 49ba939

File tree

3 files changed

+52
-17
lines changed

3 files changed

+52
-17
lines changed

benchmark/humongous/Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[deps]
2-
AtomsIOPython = "9e4c859b-2281-48ef-8059-f50fe53c37b0"
2+
AtomsIO = "1692102d-eeb4-4df9-807b-c9517f998d44"
33
BenchmarkCI = "20533458-34a3-403d-a444-e18f38190b5b"
44
BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"
55
DFTK = "acf6eb54-70d9-11e9-0013-234b7a5f5337"

benchmark/humongous/benchmarks.jl

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,23 @@
11
using BenchmarkTools
22
using TestItemRunner
33

4-
const SUITE = BenchmarkGroup()
4+
function run_scenario(scenario, complexity)
5+
scenario_filter(i) = occursin(string(scenario), i.filename) && complexity i.tags
6+
@run_package_tests filter=scenario_filter
7+
end
58

6-
SUITE["AlSiO2H"] = BenchmarkGroup()
7-
SUITE["AlSiO2H"] = @benchmarkable @run_package_tests filter=(i->occursin("AlSiO2H.jl", i.filename) &&
8-
:debug i.tags)
9+
all_scenarios() = [:AlSiO2H, :Cr19, :Fe2MnAl, :Mn2RuGa, :WFe]
10+
function make_suite(; scenarios=all_scenarios(), complexity=:debug)
11+
@assert complexity [:debug, :small, :full]
12+
@assert all(scenarios .∈ Ref(all_scenarios()))
13+
14+
suite = BenchmarkGroup()
15+
16+
for scenario in scenarios
17+
suite[scenario] = BenchmarkGroup()
18+
suite[scenario] = @benchmarkable run_scenario($scenario, $complexity)
19+
end
20+
suite
21+
end
22+
23+
const SUITE = make_suite(; scenarios=[:AlSiO2H])

benchmark/humongous/run.jl

Lines changed: 32 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,43 @@
1-
ROOTPATH = joinpath(@__DIR__, "../..")
1+
ROOTPATH = abspath(joinpath(@__DIR__, "../.."))
22
import Pkg
33
Pkg.activate(@__DIR__)
44
if !isfile(joinpath(@__DIR__, "Manifest.toml"))
55
Pkg.develop(Pkg.PackageSpec(; path=ROOTPATH))
66
Pkg.instantiate()
77
end
88

9-
using BenchmarkCI
10-
9+
import BenchmarkCI
1110
import LibGit2
12-
repo = mktempdir(mktempdir()) # TestItemRunner needs access to parent directory as well.
13-
LibGit2.clone("https://github.com/epolack/DFTK-testproblems", repo)
1411

15-
# Workaround to be able to benchmark releases before the use of PkgBenchmark.
16-
script = tempname(repo) * ".jl"
17-
benchpath = joinpath(ROOTPATH, "benchmark", "humongous", "benchmarks.jl")
18-
project = dirname(benchpath)
19-
cp(benchpath, script)
12+
"""
13+
Launch with
14+
```julia
15+
julia --project=benchmark/humongous -e '
16+
include("benchmark/humongous/run.jl")
17+
run_benchmark()'
18+
```
19+
"""
20+
function run_benchmark(; retune=false, baseline="origin/master", target="HEAD",
21+
script=nothing)
22+
mktempdir(mktempdir()) do repo_dir # TestItemRunner needs access to parent directory as well.
23+
project = joinpath(ROOTPATH, "benchmark", "humongous")
24+
# Workaround to be able to benchmark releases before the use of PkgBenchmark.
25+
# WARN: In this case, we need PkgBenchmark to be installed globally.
26+
if isnothing(script)
27+
# We run the default benchmark.
28+
script = joinpath(project, "benchmarks.jl")
29+
else
30+
occursin(ROOTPATH, abspath(script)) &&
31+
error("Script should be outside the repository.")
32+
end
33+
script_copy = joinpath(repo_dir, "benchmarks.jl")
34+
cp(script, script_copy)
35+
36+
LibGit2.clone("https://github.com/epolack/DFTK-testproblems",
37+
joinpath(repo_dir, "test"))
2038

21-
BenchmarkCI.judge(; retune=true, script, project)
39+
BenchmarkCI.judge(; baseline, target, retune, script=script_copy, project)
2240

23-
BenchmarkCI.displayjudgement()
41+
BenchmarkCI.displayjudgement()
42+
end
43+
end

0 commit comments

Comments
 (0)