carstenbauer / MonteCarlo.jl

Classical and quantum Monte Carlo simulations in Julia
https://carstenbauer.github.io/MonteCarlo.jl/dev/
Other
190 stars 19 forks source link

Update Hubbard Model & LatPhys compatability #65

Closed ffreyer closed 4 years ago

ffreyer commented 4 years ago

Shouldn't interaction_matrix_exp! include some term like exp(-power * lambda * sum(conf[slice, ;]))?

ffreyer commented 4 years ago

Shouldn't interaction_matrix_exp! include some term like exp(-power * lambda * sum(conf[slice, ;]))?

No, that's given through ΔE_boson which propose_local returns.

ffreyer commented 4 years ago

Performance test

using MonteCarlo
enable_benchmarks()
model = HubbardModelAttractive(L=8, dims=2)
dqmc = DQMC(model, beta=2.0, delta_tau = 0.1)
run!(dqmc, sweeps=1, thermalization=100)
reset_timer!()
dqmc = DQMC(model, beta=2.0, delta_tau = 0.1)
run!(dqmc, sweeps=1, thermalization=100)
print_timer()

Without vmul! (LoopVectorization):

 Section                                      ncalls     time   %tot     avg     alloc   %tot      avg
 ─────────────────────────────────────────────────────────────────────────────────────────────────────
 run!                                              1    3.16s   100%   3.16s    396MiB  100%    396MiB
   propagate                                   4.04k    2.19s  69.4%   543μs    395MiB  100%    100KiB
     add_slice_sequence_right                    202    553ms  17.5%  2.74ms   45.4MiB  11.5%   230KiB
       multiply_daggered_slice_matrix_left!    2.02k   73.7ms  2.33%  36.5μs   1.66KiB  0.00%    0.84B
         slice_matrix!                         2.02k   34.3ms  1.08%  17.0μs      848B  0.00%    0.42B
           interaction_matrix_exp!             2.02k   2.06ms  0.07%  1.02μs     0.00B  0.00%    0.00B

     propagate                                   202    474ms  15.0%  2.35ms    149MiB  37.6%   754KiB
       calculate_greens                          202    376ms  11.9%  1.86ms    110MiB  27.8%   558KiB
       wrap_greens!                              101   7.21ms  0.23%  71.4μs   4.97KiB  0.00%    50.4B
...

With (just) vmul!:

 Section                                      ncalls     time   %tot     avg     alloc   %tot      avg
 ─────────────────────────────────────────────────────────────────────────────────────────────────────
 run!                                              1    2.17s   100%   2.17s    396MiB  100%    396MiB
   propagate                                   4.04k    1.23s  56.9%   305μs    395MiB  100%    100KiB
     add_slice_sequence_right                    202    229ms  10.6%  1.13ms   45.5MiB  11.5%   230KiB
       multiply_daggered_slice_matrix_left!    2.02k   51.7ms  2.38%  25.6μs   33.2KiB  0.01%    16.8B
         slice_matrix!                         2.02k   24.2ms  1.12%  12.0μs      848B  0.00%    0.42B
           interaction_matrix_exp!             2.02k   1.77ms  0.08%   877ns     0.00B  0.00%    0.00B

     propagate                                   202    328ms  15.1%  1.62ms    149MiB  37.5%   754KiB
       calculate_greens                          202    247ms  11.4%  1.22ms    110MiB  27.8%   558KiB
       wrap_greens!                              101   5.16ms  0.24%  51.1μs   4.97KiB  0.00%    50.4B
...
ffreyer commented 4 years ago

julia 1.0 uses a really old version of LoopVectorization - that's why that fails. Julia 1.2 works, so does 1.4... Installed LoopVectorization ──── v0.1.3