Skip to content

Commit 53f09ad

Browse files
committed
testing new interface
1 parent d6846b3 commit 53f09ad

File tree

4 files changed

+45
-31
lines changed

4 files changed

+45
-31
lines changed

benchmark/Project.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
[deps]
22
BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"
33
DFTK = "acf6eb54-70d9-11e9-0013-234b7a5f5337"
4+
LibGit2 = "76f85450-5226-5b5a-8eaa-529ad045b433"
5+
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
6+
MKL = "33e6dc65-8f57-5167-99aa-e5a354878fb2"
47
PkgBenchmark = "32113eaa-f34f-5b0d-bd6c-c81e245fc73d"
58
TestItemRunner = "f8b46487-2199-4994-9208-9a1283c18c0a"

benchmark/benchmarks.jl

Lines changed: 5 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,12 @@
11
# https://opensourc.es/blog/constraint-solver-bugs-and-benchmarks/
22
# https://github.com/JuliaSymbolics/Symbolics.jl/blob/master/benchmark/benchmarks.jl
33
using BenchmarkTools
4-
using DFTK
5-
using TestItemRunner
4+
import LibGit2
65

7-
function run_bench()
8-
# very artificial silicon ground state example
9-
a = 10.26
10-
lattice = a / 2 * [[0 1 1.];
11-
[1 0 1.];
12-
[1 1 0.]]
13-
Si = ElementPsp(:Si; psp=load_psp("hgh/lda/Si-q4"))
14-
atoms = [Si, Si]
15-
positions = [ones(3)/8, -ones(3)/8]
16-
magnetic_moments = [2, -2]
17-
18-
model = model_LDA(lattice, atoms, positions;
19-
magnetic_moments, temperature=0.1, spin_polarization=:collinear)
20-
basis = PlaneWaveBasis(model; Ecut=5, kgrid=[2, 2, 2])
21-
ρ0 = guess_density(basis, magnetic_moments)
22-
scfres = self_consistent_field(basis; ρ=ρ0, tol=1e-2, maxiter=3, callback=identity)
23-
end
6+
repo = mktempdir()
7+
LibGit2.clone("https://github.com/mfherbst/DFTK-testproblems", repo)
248

259
const SUITE = BenchmarkGroup()
26-
SUITE["dummy"] = BenchmarkGroup()
27-
run_bench() # precompiling
28-
SUITE["dummy"] = @benchmarkable run_bench()
29-
30-
SUITE["sudoku"] = BenchmarkGroup()
31-
SUITE["sudoku"] = @benchmarkable (1+1) seconds=2
3210

33-
SUITE["minimal"] = BenchmarkGroup()
34-
# @run_package_tests filter=i-> :minimal in i.tags
35-
SUITE["minimal"] = @benchmarkable @run_package_tests filter=ti->(:minimal ti.tags)
11+
SUITE["AlSiO2H"] = BenchmarkGroup()
12+
SUITE["AlSiO2H"] = @benchmarkable include(joinpath(repo, "AlSiO2H.jl"))

benchmark/benchmarks_new.jl

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# https://opensourc.es/blog/constraint-solver-bugs-and-benchmarks/
2+
# https://github.com/JuliaSymbolics/Symbolics.jl/blob/master/benchmark/benchmarks.jl
3+
using BenchmarkTools
4+
using DFTK
5+
using TestItemRunner
6+
7+
function run_bench()
8+
# very artificial silicon ground state example
9+
a = 10.26
10+
lattice = a / 2 * [[0 1 1.];
11+
[1 0 1.];
12+
[1 1 0.]]
13+
Si = ElementPsp(:Si; psp=load_psp("hgh/lda/Si-q4"))
14+
atoms = [Si, Si]
15+
positions = [ones(3)/8, -ones(3)/8]
16+
magnetic_moments = [2, -2]
17+
18+
model = model_LDA(lattice, atoms, positions;
19+
magnetic_moments, temperature=0.1, spin_polarization=:collinear)
20+
basis = PlaneWaveBasis(model; Ecut=5, kgrid=[2, 2, 2])
21+
ρ0 = guess_density(basis, magnetic_moments)
22+
scfres = self_consistent_field(basis; ρ=ρ0, tol=1e-2, maxiter=3, callback=identity)
23+
end
24+
25+
const SUITE = BenchmarkGroup()
26+
SUITE["dummy"] = BenchmarkGroup()
27+
run_bench() # precompiling
28+
SUITE["dummy"] = @benchmarkable run_bench()
29+
30+
SUITE["sudoku"] = BenchmarkGroup()
31+
SUITE["sudoku"] = @benchmarkable (1+1) seconds=2
32+
33+
SUITE["minimal"] = BenchmarkGroup()
34+
# @run_package_tests filter=i-> :minimal in i.tags
35+
SUITE["minimal"] = @benchmarkable @run_package_tests filter=ti->(:minimal ti.tags)

benchmark/runbenchmarks.jl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,9 @@ end
88

99
using PkgBenchmark
1010

11-
# Hack for older releases. PkgBenchmark need read access to parent directory as well…
12-
script = tempname(mktempdir(mktempdir())) * ".jl"
11+
script = tempname() * ".jl"
1312
benchpath = joinpath(ROOTPATH, "benchmark", "benchmarks.jl")
14-
cp(benchpath, script; force=true)
13+
cp(benchpath, script)
1514

1615
juliacmd=`$(joinpath(Sys.BINDIR, Base.julia_exename())) -O3 -e"import Pkg; Pkg.activate(\"$ROOTPATH\"); Pkg.instantiate();"`
1716
current = BenchmarkConfig(; id="HEAD", juliacmd)

0 commit comments

Comments
 (0)