Skip to content

Commit

Permalink
Merge branch 'develop' into feature/arrow-dvec
Browse files Browse the repository at this point in the history
  • Loading branch information
mtsch committed Sep 20, 2023
2 parents e322566 + a67fc28 commit 22be146
Show file tree
Hide file tree
Showing 6 changed files with 85 additions and 40 deletions.
1 change: 1 addition & 0 deletions benchmark/Project.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
[deps]
BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"
KrylovKit = "0b1a1467-8014-51b9-945f-bf0ae24f4b77"
117 changes: 80 additions & 37 deletions benchmark/benchmarks.jl
Original file line number Diff line number Diff line change
@@ -1,42 +1,85 @@
using Rimu
using KrylovKit
using BenchmarkTools

const SUITE = @benchmarkset "Rimu" begin
@case "(10, 20) Mom space with projected energy and initiator" begin
add = BoseFS(ntuple(i -> ifelse(i == 10, 10, 0), 20))
ham = HubbardMom1D(add, u=6.0)
dv = InitiatorDVec(add => 1.0; style=IsDynamicSemistochastic())
post_step = ProjectedEnergy(ham, dv)
s_strat = DoubleLogUpdate(targetwalkers=20_000)

lomc!(ham, dv; s_strat, post_step, dτ=1e-4, laststep=4000)
end seconds=150
@case "(4+1, 11) 2C Mom space with G2Correlators" begin
add = BoseFS2C(ntuple(i -> ifelse(i == 5, 4, 0), 11), ntuple(==(5), 11))
ham = BoseHubbardMom1D2C(add, v=0.1)
dv = DVec(add => 1.0f0; style=IsDynamicSemistochastic{Float32}())
s_strat = DoubleLogUpdate(targetwalkers=10_000)
replica = AllOverlaps(2, ntuple(i -> G2Correlator(i - 1), 7))

lomc!(ham, dv; s_strat, replica, laststep=2000)
end seconds=150
@case "(50, 50) Real space" begin
add = near_uniform(BoseFS{50,50})
ham = HubbardReal1D(add, u=6.0)
dv = DVec(add => 1.0; style=IsDynamicSemistochastic())
s_strat = DoubleLogUpdate(targetwalkers=50_000)

lomc!(ham, dv; s_strat, dτ=1e-4, laststep=2000)
end seconds=150
@case "(5+3, 12) Real space fermions in a 4×3 lattice with initiator" begin
add = CompositeFS(
near_uniform(FermiFS{5,12}),
near_uniform(FermiFS{3,12}),
)
ham = HubbardRealSpace(add, geometry=PeriodicBoundaries(4, 3))
dv = InitiatorDVec(add => 1.0, style=IsDynamicSemistochastic())
s_strat = DoubleLogUpdate(targetwalkers=10_000)

lomc!(ham, dv; s_strat, laststep=15_000, dτ=1e-2)
end seconds=150
@benchmarkset "Exact" begin
@benchmarkset "Diagonalization" begin
@case "2D Hubbard" begin
M = 16
addr = FermiFS2C(M, 1 => 1, 2 => 1, 1 => -1, 2 => -1)
ham = HubbardRealSpace(addr; geometry=PeriodicBoundaries(4, 4))
dv = DVec(addr => 1.0)
eigsolve(ham, dv, 1, :SR; issymmetric=true, tol=1e-9)
end seconds=30

@case "Bose-Hubbard in momentum space" begin
M = N = 10
addr = BoseFS(M, M ÷ 2 => N)
ham = HubbardMom1D(addr; u=6.0)
dv = DVec(addr => 1.0)
eigsolve(ham, dv, 1, :SR; issymmetric=true, tol=1e-9)
end seconds=40
end

@benchmarkset "Multiplication" begin
@case "Momentum space" begin
# dimension is 189225
M = 20
addr = BoseFS(M, M÷2 => 10)
ham = HubbardMom1D(addr; u=6.0)
dv1 = DVec(addr => 1.0)
dv2 = zerovector(dv1)
mul!(dv2, ham, dv1)
mul!(dv1, ham, dv2)
mul!(dv2, ham, dv1)
mul!(dv1, ham, dv2)
mul!(dv2, ham, dv1)
end seconds=10

@case "Transcorrelated" begin
# dimension is 189225
M = 30
addr = FermiFS2C(M, M÷2-1 => 1, M => 1, M÷2 => -1, M÷2+1 => -1)
ham = Transcorrelated1D(addr)
dv1 = DVec(addr => 1.0)
dv2 = zerovector(dv1)
mul!(dv2, ham, dv1)
mul!(dv1, ham, dv2)
mul!(dv2, ham, dv1)
mul!(dv1, ham, dv2)
end seconds=10
end
end

@benchmarkset "FCIQMC" begin
@case "(10, 20) Mom space with projected energy and initiator" begin
addr = BoseFS(20, 10 => 10)
ham = HubbardMom1D(addr, u=1.0)
dv = InitiatorDVec(addr => 1.0; style=IsDynamicSemistochastic())
post_step = ProjectedEnergy(ham, dv)
s_strat = DoubleLogUpdate(targetwalkers=40_000)

lomc!(ham, dv; s_strat, post_step, dτ=1e-4, laststep=8000)
end seconds=150

@case "(4+1, 11) 2C Mom space with G2Correlators" begin
addr = BoseFS2C(ntuple(i -> ifelse(i == 5, 4, 0), 11), ntuple(==(5), 11))
ham = BoseHubbardMom1D2C(addr, v=0.1)
dv = DVec(addr => 1.0f0; style=IsDynamicSemistochastic{Float32}())
s_strat = DoubleLogUpdate(targetwalkers=10_000)
replica = AllOverlaps(2, ntuple(i -> G2Correlator(i - 1), 7))

lomc!(ham, dv; s_strat, replica, laststep=2000)
end seconds=150

@case "(50, 50) Real space" begin
addr = near_uniform(BoseFS{50,50})
ham = HubbardReal1D(addr, u=6.0)
dv = DVec(addr => 1.0; style=IsDynamicSemistochastic())
s_strat = DoubleLogUpdate(targetwalkers=50_000)

lomc!(ham, dv; s_strat, dτ=1e-4, laststep=1000)
end seconds=150
end
end
2 changes: 1 addition & 1 deletion benchmark/tune.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[{"Julia":"1.6.0","BenchmarkTools":"0.7.0"},[["BenchmarkGroup",{"data":{"bose_hubbard_mom_1d":["BenchmarkGroup",{"data":{"small":["Parameters",{"gctrial":true,"time_tolerance":0.05,"samples":3,"evals":1,"gcsample":false,"seconds":100.0,"overhead":0.0,"memory_tolerance":0.01}],"big":["Parameters",{"gctrial":true,"time_tolerance":0.05,"samples":3,"evals":1,"gcsample":false,"seconds":100.0,"overhead":0.0,"memory_tolerance":0.01}]},"tags":[]}],"bose_hubbard_real_1d":["BenchmarkGroup",{"data":{"small":["Parameters",{"gctrial":true,"time_tolerance":0.05,"samples":3,"evals":1,"gcsample":false,"seconds":100.0,"overhead":0.0,"memory_tolerance":0.01}],"big":["Parameters",{"gctrial":true,"time_tolerance":0.05,"samples":3,"evals":1,"gcsample":false,"seconds":100.0,"overhead":0.0,"memory_tolerance":0.01}]},"tags":[]}],"bose_hubbard_real_1d_2c":["BenchmarkGroup",{"data":{"small":["Parameters",{"gctrial":true,"time_tolerance":0.05,"samples":3,"evals":1,"gcsample":false,"seconds":100.0,"overhead":0.0,"memory_tolerance":0.01}],"big":["Parameters",{"gctrial":true,"time_tolerance":0.05,"samples":3,"evals":1,"gcsample":false,"seconds":100.0,"overhead":0.0,"memory_tolerance":0.01}]},"tags":[]}],"micro":["BenchmarkGroup",{"data":{"diagonal_element":["BenchmarkGroup",{"data":{"256bit":["BenchmarkGroup",{"data":{"Real1D":["Parameters",{"gctrial":true,"time_tolerance":0.05,"samples":10000,"evals":10,"gcsample":false,"seconds":5.0,"overhead":0.0,"memory_tolerance":0.01}],"Mom1D":["Parameters",{"gctrial":true,"time_tolerance":0.05,"samples":10000,"evals":5,"gcsample":false,"seconds":5.0,"overhead":0.0,"memory_tolerance":0.01}]},"tags":[]}],"128bit":["BenchmarkGroup",{"data":{"Real1D":["Parameters",{"gctrial":true,"time_tolerance":0.05,"samples":10000,"evals":228,"gcsample":false,"seconds":5.0,"overhead":0.0,"memory_tolerance":0.01}],"Mom1D":["Parameters",{"gctrial":true,"time_tolerance":0.05,"samples":10000,"evals":163,"gcsample":false,"seconds":5.0,"overhead":0.0,"memory_tolerance":0.01}]},"tags":[]}],"64bit":["BenchmarkGroup",{"data":{"Real1D":["Parameters",{"gctrial":true,"time_tolerance":0.05,"samples":10000,"evals":965,"gcsample":false,"seconds":5.0,"overhead":0.0,"memory_tolerance":0.01}],"Mom1D":["Parameters",{"gctrial":true,"time_tolerance":0.05,"samples":10000,"evals":250,"gcsample":false,"seconds":5.0,"overhead":0.0,"memory_tolerance":0.01}]},"tags":[]}],"16bit":["BenchmarkGroup",{"data":{"Real1D":["Parameters",{"gctrial":true,"time_tolerance":0.05,"samples":10000,"evals":998,"gcsample":false,"seconds":5.0,"overhead":0.0,"memory_tolerance":0.01}],"Mom1D":["Parameters",{"gctrial":true,"time_tolerance":0.05,"samples":10000,"evals":949,"gcsample":false,"seconds":5.0,"overhead":0.0,"memory_tolerance":0.01}]},"tags":[]}]},"tags":[]}],"numberoccupiedsites":["BenchmarkGroup",{"data":{"256bit":["Parameters",{"gctrial":true,"time_tolerance":0.05,"samples":10000,"evals":199,"gcsample":false,"seconds":5.0,"overhead":0.0,"memory_tolerance":0.01}],"128bit":["Parameters",{"gctrial":true,"time_tolerance":0.05,"samples":10000,"evals":919,"gcsample":false,"seconds":5.0,"overhead":0.0,"memory_tolerance":0.01}],"64bit":["Parameters",{"gctrial":true,"time_tolerance":0.05,"samples":10000,"evals":976,"gcsample":false,"seconds":5.0,"overhead":0.0,"memory_tolerance":0.01}],"16bit":["Parameters",{"gctrial":true,"time_tolerance":0.05,"samples":10000,"evals":999,"gcsample":false,"seconds":5.0,"overhead":0.0,"memory_tolerance":0.01}]},"tags":[]}],"fciqmc_col":["BenchmarkGroup",{"data":{"256bit":["BenchmarkGroup",{"data":{"Real1D":["BenchmarkGroup",{"data":{},"tags":[]}],"Mom1D":["BenchmarkGroup",{"data":{},"tags":[]}]},"tags":[]}],"128bit":["BenchmarkGroup",{"data":{"Real1D":["BenchmarkGroup",{"data":{},"tags":[]}],"Mom1D":["BenchmarkGroup",{"data":{},"tags":[]}]},"tags":[]}],"64bit":["BenchmarkGroup",{"data":{"Real1D":["BenchmarkGroup",{"data":{},"tags":[]}],"Mom1D":["BenchmarkGroup",{"data":{},"tags":[]}]},"tags":[]}],"16bit":["BenchmarkGroup",{"data":{"Real1D":["BenchmarkGroup",{"data":{},"tags":[]}],"Mom1D":["BenchmarkGroup",{"data":{},"tags":[]}]},"tags":[]}]},"tags":[]}],"kinetic_energy":["BenchmarkGroup",{"data":{"256bit":["BenchmarkGroup",{"data":{"Real1D":["BenchmarkGroup",{"data":{},"tags":[]}],"Mom1D":["Parameters",{"gctrial":true,"time_tolerance":0.05,"samples":10000,"evals":40,"gcsample":false,"seconds":5.0,"overhead":0.0,"memory_tolerance":0.01}]},"tags":[]}],"128bit":["BenchmarkGroup",{"data":{"Real1D":["BenchmarkGroup",{"data":{},"tags":[]}],"Mom1D":["Parameters",{"gctrial":true,"time_tolerance":0.05,"samples":10000,"evals":383,"gcsample":false,"seconds":5.0,"overhead":0.0,"memory_tolerance":0.01}]},"tags":[]}],"64bit":["BenchmarkGroup",{"data":{"Real1D":["BenchmarkGroup",{"data":{},"tags":[]}],"Mom1D":["Parameters",{"gctrial":true,"time_tolerance":0.05,"samples":10000,"evals":905,"gcsample":false,"seconds":5.0,"overhead":0.0,"memory_tolerance":0.01}]},"tags":[]}],"16bit":["BenchmarkGroup",{"data":{"Real1D":["BenchmarkGroup",{"data":{},"tags":[]}],"Mom1D":["Parameters",{"gctrial":true,"time_tolerance":0.05,"samples":10000,"evals":994,"gcsample":false,"seconds":5.0,"overhead":0.0,"memory_tolerance":0.01}]},"tags":[]}]},"tags":[]}],"get_offdiagonal":["BenchmarkGroup",{"data":{"256bit":["BenchmarkGroup",{"data":{"Real1D":["Parameters",{"gctrial":true,"time_tolerance":0.05,"samples":10000,"evals":975,"gcsample":false,"seconds":5.0,"overhead":0.0,"memory_tolerance":0.01}],"Mom1D":["Parameters",{"gctrial":true,"time_tolerance":0.05,"samples":10000,"evals":7,"gcsample":false,"seconds":5.0,"overhead":0.0,"memory_tolerance":0.01}]},"tags":[]}],"128bit":["BenchmarkGroup",{"data":{"Real1D":["Parameters",{"gctrial":true,"time_tolerance":0.05,"samples":10000,"evals":989,"gcsample":false,"seconds":5.0,"overhead":0.0,"memory_tolerance":0.01}],"Mom1D":["Parameters",{"gctrial":true,"time_tolerance":0.05,"samples":10000,"evals":10,"gcsample":false,"seconds":5.0,"overhead":0.0,"memory_tolerance":0.01}]},"tags":[]}],"64bit":["BenchmarkGroup",{"data":{"Real1D":["Parameters",{"gctrial":true,"time_tolerance":0.05,"samples":10000,"evals":996,"gcsample":false,"seconds":5.0,"overhead":0.0,"memory_tolerance":0.01}],"Mom1D":["Parameters",{"gctrial":true,"time_tolerance":0.05,"samples":10000,"evals":207,"gcsample":false,"seconds":5.0,"overhead":0.0,"memory_tolerance":0.01}]},"tags":[]}],"16bit":["BenchmarkGroup",{"data":{"Real1D":["Parameters",{"gctrial":true,"time_tolerance":0.05,"samples":10000,"evals":996,"gcsample":false,"seconds":5.0,"overhead":0.0,"memory_tolerance":0.01}],"Mom1D":["Parameters",{"gctrial":true,"time_tolerance":0.05,"samples":10000,"evals":935,"gcsample":false,"seconds":5.0,"overhead":0.0,"memory_tolerance":0.01}]},"tags":[]}]},"tags":[]}]},"tags":[]}],"bose_hubbard_mom_1d_2c":["BenchmarkGroup",{"data":{"small":["Parameters",{"gctrial":true,"time_tolerance":0.05,"samples":3,"evals":1,"gcsample":false,"seconds":100.0,"overhead":0.0,"memory_tolerance":0.01}],"big":["Parameters",{"gctrial":true,"time_tolerance":0.05,"samples":3,"evals":1,"gcsample":false,"seconds":100.0,"overhead":0.0,"memory_tolerance":0.01}]},"tags":[]}]},"tags":[]}]]]
[{"Julia":"1.10.0-alpha1","BenchmarkTools":"1.0.0"},[["BenchmarkGroup",{"data":{"Rimu":["BenchmarkGroup",{"data":{"Exact":["BenchmarkGroup",{"data":{"Diagonalization":["BenchmarkGroup",{"data":{"Bose-Hubbard in momentum space":["Parameters",{"gctrial":true,"time_tolerance":0.05,"samples":10000,"evals":1,"gcsample":false,"seconds":40.0,"overhead":0.0,"memory_tolerance":0.01}],"2D Hubbard":["Parameters",{"gctrial":true,"time_tolerance":0.05,"samples":10000,"evals":1,"gcsample":false,"seconds":30.0,"overhead":0.0,"memory_tolerance":0.01}]},"tags":[]}],"Multiplication":["BenchmarkGroup",{"data":{"Momentum space":["Parameters",{"gctrial":true,"time_tolerance":0.05,"samples":10000,"evals":1,"gcsample":false,"seconds":10.0,"overhead":0.0,"memory_tolerance":0.01}],"Transcorrelated":["Parameters",{"gctrial":true,"time_tolerance":0.05,"samples":10000,"evals":1,"gcsample":false,"seconds":10.0,"overhead":0.0,"memory_tolerance":0.01}]},"tags":[]}]},"tags":[]}],"FCIQMC":["BenchmarkGroup",{"data":{"(4+1, 11) 2C Mom space with G2Correlators":["Parameters",{"gctrial":true,"time_tolerance":0.05,"samples":10000,"evals":1,"gcsample":false,"seconds":150.0,"overhead":0.0,"memory_tolerance":0.01}],"(50, 50) Real space":["Parameters",{"gctrial":true,"time_tolerance":0.05,"samples":10000,"evals":1,"gcsample":false,"seconds":150.0,"overhead":0.0,"memory_tolerance":0.01}],"(10, 20) Mom space with projected energy and initiator":["Parameters",{"gctrial":true,"time_tolerance":0.05,"samples":10000,"evals":1,"gcsample":false,"seconds":150.0,"overhead":0.0,"memory_tolerance":0.01}]},"tags":[]}]},"tags":[]}]},"tags":[]}]]]
1 change: 1 addition & 0 deletions docs/src/dictvectors.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ In addition, Rimu defines the following function.

```@docs
walkernumber
dot_from_right
```

## Projectors
Expand Down
2 changes: 1 addition & 1 deletion src/Hamiltonians/abstract.jl
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ julia> dimension(HubbardReal1D(near_uniform(BoseFS{200,100})))|>Float64
When extending `AbstractHamiltonian`, define a method for the two-argument form
`dimension(h::MyNewHamiltonian, addr)`.
See also [`BasisSetRep`](@doc).
See also [`BasisSetRep`](@ref).
"""
dimension(h::AbstractHamiltonian) = dimension(h, starting_address(h))
dimension(::AbstractHamiltonian, addr) = dimension(addr)
Expand Down
2 changes: 1 addition & 1 deletion src/Hamiltonians/angular_momentum.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
AxialAngularMomentumHO(S; z_dim = 3, addr = BoseFS(prod(S))) <: AbstractHamiltonian
Angular momentum operator for application to Cartesian harmonic oscillator basis,
see [`HOCartesianEnergyConserved`](@ref) or [`HOCartesianEnergyConservedPerDim`](@ref).
see [`HOCartesianContactInteractions`](@ref) or [`HOCartesianEnergyConservedPerDim`](@ref).
Represents the projection of angular momentum onto `z`-axis:
```math
\\hat{L}_z = i \\hbar \\sum_{j=1}^N \\left( b_x b_y^\\dag - b_y b_x^\\dag \\right),
Expand Down

0 comments on commit 22be146

Please sign in to comment.