latticegpu.jl/src/main/times.jl
2021-11-07 21:56:32 +01:00

117 lines
2.9 KiB
Julia

using CUDA, Logging, Random, TimerOutputs
CUDA.allowscalar(false)
import Pkg
Pkg.activate("/lhome/ific/a/alramos/s.images/julia/workspace/LatticeGPU")
#Pkg.activate("/home/alberto/code/julia/LatticeGPU")
using LatticeGPU
# Set lattice/block size
ntwist = (0,0,0,0,0,0)
lp = SpaceParm{4}((32,32,32,32), (4,4,4,4), BC_PERIODIC, ntwist)
println("Space Parameters: ", lp)
# Seed RNG
println("Seeding CURAND...")
Random.seed!(CURAND.default_rng(), 1234)
Random.seed!(1234)
# Set group and precision
GRP = SU3
ALG = SU3alg
PREC = Float64
println("Precision: ", PREC)
# MD integrator
int = omf4(PREC, 0.1, 10)
println(int)
println("Allocating YM workspace")
ymws = YMworkspace(GRP, PREC, lp)
# Main program
println("Allocating gauge field")
U = vector_field(GRP{PREC}, lp)
fill!(U, one(GRP{PREC}))
println("Time to take the configuration to memory: ")
@time Ucpu = Array(U)
# Set gauge parameters
# FIRST SET: Wilson action/flow
println("\n## WILSON ACTION/FLOW TIMES")
gp = GaugeParm{PREC}(GRP{PREC}, 6.0, 1.0)
println("Gauge Parameters: ", gp)
flwint = wfl_rk3(PREC, 0.005, 1.0E-6)
println(flwint)
println("Initial Action: ")
@time S = gauge_action(U, lp, gp, ymws)
HMC!(U,int.eps,1,lp, gp, ymws, noacc=true)
pl = Vector{Float64}()
for i in 1:4
@time dh, acc = HMC!(U,int,lp, gp, ymws, noacc=true)
println("# HMC: ", acc, " ", dh)
push!(pl, plaquette(U,lp, gp, ymws))
println("# Plaquette: ", pl[end], "\n")
# @time x, y = sfcoupling(U,lp,gp,ymws)
# println("SF coupling: ", x, " ", y)
end
Ucp = Array(U)
println("Action: ", gauge_action(U, lp, gp, ymws))
flw(U, flwint, 1, gp, lp, ymws)
println("Time for 100 steps of RK3 flow integrator: ")
@time flw(U, flwint, 400, gp, lp, ymws)
eoft = Eoft_plaq(U, gp, lp, ymws)
eoft = Eoft_clover(U, gp, lp, ymws)
qtop = Qtop(U, gp, lp, ymws)
@time eoft = Eoft_plaq(U, gp, lp, ymws)
println("Plaq: ", eoft)
@time eoft = Eoft_clover(U, gp, lp, ymws)
println("Clov: ", eoft)
@time qtop = Qtop(U, gp, lp, ymws)
println("Qtop: ", qtop)
println("## END Wilson action/flow measurements")
# Set gauge parameters
# SECOND SET: Improved action/flow
println("\n## IMPROVED ACTION/FLOW TIMES")
gp = GaugeParm{PREC}(GRP{PREC}, 6.0, 5/6)
println("Gauge Parameters: ", gp)
flwint = zfl_rk3(PREC, 0.01, 1.0E-6)
println(flwint)
println("Initial Action: ")
@time S = gauge_action(U, lp, gp, ymws)
HMC!(U,int.eps,1,lp, gp, ymws, noacc=true)
pl = Vector{Float64}()
for i in 1:4
@time dh, acc = HMC!(U,int,lp, gp, ymws, noacc=true)
println("# HMC: ", acc, " ", dh)
push!(pl, plaquette(U,lp, gp, ymws))
println("# Plaquette: ", pl[end], "\n")
end
flw(U, flwint, 1, gp, lp, ymws)
println("Action: ", gauge_action(U, lp, gp, ymws))
println("Time for 100 steps of RK3 flow integrator: ")
@time flw(U, flwint, 100, gp, lp, ymws)
println("Action: ", gauge_action(U, lp, gp, ymws))
println("## END improved action/flow measurements")
print_timer(linechars = :ascii)
println("END")