Skip to content

Commit

Permalink
Add versioninfo function (#872)
Browse files Browse the repository at this point in the history
* versioninfo function

* Enforce newer MPI

* Remove deprecated

* Add FFT info
  • Loading branch information
mfherbst authored Aug 17, 2023
1 parent 8ce8872 commit a7b59f0
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 3 deletions.
6 changes: 4 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ Markdown = "d6f4376e-aef5-505a-96c1-9c027394607a"
Optim = "429524aa-4258-5aef-a3af-852621145aeb"
OrderedCollections = "bac558e1-5e72-5ebc-8fee-abe8a469f55d"
PeriodicTable = "7b2266bf-644c-5ea3-82d8-af4bbd25a884"
PkgVersion = "eebad327-c553-4316-9ea0-9fa01ccd7688"
Polynomials = "f27b6e38-b328-58d1-80ce-0feddd5e7a45"
PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a"
Preferences = "21216c6a-2e73-6563-6e65-726566657250"
Expand All @@ -54,7 +55,7 @@ AtomsBase = "0.3.1"
Brillouin = "0.5.11"
ChainRulesCore = "1.15"
DftFunctionals = "0.2"
FFTW = "1"
FFTW = "1.5"
ForwardDiff = "0.10"
GPUArraysCore = "0.1"
InteratomicPotentials = "0.2"
Expand All @@ -65,10 +66,11 @@ LazyArtifacts = "1.3"
Libxc = "0.3.14"
LineSearches = "7"
LinearMaps = "3"
MPI = "0.19, 0.20"
MPI = "0.20.13"
Optim = "1"
OrderedCollections = "1"
PeriodicTable = "1"
PkgVersion = "0.3"
Polynomials = "3"
PrecompileTools = "1"
Preferences = "1"
Expand Down
1 change: 1 addition & 0 deletions src/DFTK.jl
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ include("common/mpi.jl")
include("common/threading.jl")
include("common/printing.jl")
include("common/cis2pi.jl")
include("common/versioninfo.jl")
include("architecture.jl")
include("common/zeros_like.jl")
include("common/norm.jl")
Expand Down
2 changes: 1 addition & 1 deletion src/PlaneWaveBasis.jl
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,7 @@ function gather_kpts(data::AbstractArray, basis::PlaneWaveBasis)
allk_data = similar(data, n_kpts)
allk_data[basis.krange_allprocs[1]] = data
for rank in 1:mpi_nprocs(basis.comm_kpts) - 1 # Note: MPI ranks are 0-based
rk_data, status = MPI.recv(rank, tag, basis.comm_kpts)
rk_data, status = MPI.recv(basis.comm_kpts, MPI.Status; source=rank, tag=tag)
@assert MPI.Get_error(status) == 0 # all went well
allk_data[basis.krange_allprocs[rank + 1]] = rk_data
end
Expand Down
25 changes: 25 additions & 0 deletions src/common/versioninfo.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using PkgVersion


"""
DFTK.versioninfo([io::IO=stdout])
Summary of version and configuration of DFTK and its key dependencies.
"""
function versioninfo(io::IO=stdout)
indent = " "
println(io, "DFTK Version ", PkgVersion.@Version)
println(io, "Julia Version ", VERSION)
println(io, "FFTW.jl provider ", FFTW.get_provider(), " v$(FFTW.version)")
println(io)

let versionstr = sprint(show, "text/plain", BLAS.get_config())
println(io, "BLAS.get_config()")
println(io, indent, replace(versionstr, "\n" => "\n" * indent), "\n")
end

let versionstr = sprint(MPI.versioninfo)
println(io, "MPI.versioninfo()")
println(io, indent, replace(versionstr, "\n" => "\n" * indent), "\n")
end
end
8 changes: 8 additions & 0 deletions src/show.jl
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,14 @@ end

function Base.show(io::IO, ::MIME"text/plain", basis::PlaneWaveBasis)
println(io, "PlaneWaveBasis discretization:")

showfieldln(io, "architecture", basis.architecture)
showfieldln(io, "num. mpi processes", mpi_nprocs(basis.comm_kpts))
showfieldln(io, "num. julia threads", Threads.nthreads())
showfieldln(io, "num. blas threads", BLAS.get_num_threads())
showfieldln(io, "num. fft threads", FFTW.get_num_threads())
println(io)

showfieldln(io, "Ecut", basis.Ecut, " Ha")
showfieldln(io, "fft_size", basis.fft_size, ", ", prod(basis.fft_size), " total points")
if !basis.variational
Expand Down
7 changes: 7 additions & 0 deletions test/printing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,10 @@ include("testcases.jl")
test_scfres_printing()
test_basis_printing(; modelargs=(; εF=0.5))
end

@testset "versioninfo" begin
versioninfo = sprint(DFTK.versioninfo)
@test occursin("Julia Version", versioninfo)
@test occursin("DFTK Version", versioninfo)
@test occursin("BLAS", versioninfo)
end

0 comments on commit a7b59f0

Please sign in to comment.