Skip to content

Instantly share code, notes, and snippets.

@timholy
Created February 24, 2022 17:49
Show Gist options
  • Save timholy/41a2a763e38604edb6540b572c27fd17 to your computer and use it in GitHub Desktop.
Save timholy/41a2a763e38604edb6540b572c27fd17 to your computer and use it in GitHub Desktop.
Compile-time regression script
try
using Pkg
Pkg.precompile()
catch
exit(125) # skip if we can't precompile Plots
end
cmtname, cmtsha = string(Base.VERSION), Base.GIT_VERSION_INFO.commit
tstart = time()
using Plots
tload = time()
display(plot(rand(10)))
tdone = time()
open(joinpath(@__DIR__, "ttfp_record.csv"), "a") do io
println(io, "Plots,$cmtname,$cmtsha,$(tload-tstart),$(tdone-tload)")
end
(tdone-tload) < 20 || error("too long")
tstart = time()
using DFTK
tload = time()
let
a = 10.26 # Silicon lattice constant in Bohr
lattice = a / 2 * [[0 1 1.];
[1 0 1.];
[1 1 0.]]
Si = ElementPsp(:Si, psp=load_psp("hgh/lda/Si-q4"))
atoms = [Si => [ones(3)/8, -ones(3)/8]]
model = model_atomic(lattice, atoms)
basis = PlaneWaveBasis(model; Ecut=5, kgrid=[1, 1, 1])
scfres = self_consistent_field(basis, tol=1e-0, callback=info -> nothing)
end
tdone = time()
open(joinpath(@__DIR__, "ttfp_record.csv"), "a") do io
println(io, "DFTK,$cmtname,$cmtsha,$(tload-tstart),$(tdone-tload)")
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment