Added timmings

This commit is contained in:
Alberto Ramos 2021-10-14 17:35:08 +02:00
parent 42e539c9bd
commit 30baeade9f
8 changed files with 142 additions and 112 deletions

View file

@ -310,9 +310,9 @@ uuid = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
[[TimerOutputs]]
deps = ["ExprTools", "Printf"]
git-tree-sha1 = "209a8326c4f955e2442c07b56029e88bb48299c7"
git-tree-sha1 = "7cb456f358e8f9d102a8b25e8dfedf58fa5689bc"
uuid = "a759f4b9-e2f1-59dc-863e-4aeb61b1ea8f"
version = "0.5.12"
version = "0.5.13"
[[UUIDs]]
deps = ["Random", "SHA"]

View file

@ -7,3 +7,4 @@ version = "0.1.0"
CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
StructArrays = "09ab397b-f2b6-538f-b94a-2f83cf4a842a"
TimerOutputs = "a759f4b9-e2f1-59dc-863e-4aeb61b1ea8f"

View file

@ -12,7 +12,7 @@
module YM
using CUDA, Random, StructArrays
using CUDA, Random, StructArrays, TimerOutputs
using ..Space
using ..Groups
using ..Fields
@ -48,6 +48,7 @@ struct YMworkspace{T}
rm # float of volume
function YMworkspace(::Type{G}, ::Type{T}, lp::SpaceParm) where {G <: Group, T <: AbstractFloat}
@timeit "Allocating YMWorkspace" begin
if (G == SU2)
GRP = SU2
ALG = SU2alg
@ -67,6 +68,7 @@ struct YMworkspace{T}
end
cs = scalar_field(Complex{T}, lp)
rs = scalar_field(T, lp)
end
return new{T}(GRP,ALG,T,f1, f2, mm, u1, cs, rs)
end

View file

@ -305,10 +305,14 @@ the prefactor 1/g0^2, and assign it to the workspace force `ymws.frc1`
function force_gauge(ymws::YMworkspace, U, c0, lp::SpaceParm)
if abs(c0-1) < 1.0E-10
@timeit "Wilson gauge force" begin
force_wilson_pln!(ymws.frc1, ymws.frc2, U, lp::SpaceParm)
end
else
@timeit "Improved gauge force" begin
force_wilson_pln!(ymws.frc1, ymws.frc2, U, lp::SpaceParm, c0)
end
end
return nothing
end

View file

@ -12,18 +12,22 @@
function randomize!(f, lp::SpaceParm, ymws::YMworkspace)
if ymws.ALG == SU2alg
@timeit "Randomize SU(2) algebra field" begin
m = CUDA.randn(ymws.PRC, lp.bsz,lp.ndim,3,lp.rsz)
CUDA.@sync begin
CUDA.@cuda threads=lp.bsz blocks=lp.rsz krnl_assign_SU2!(f,m,lp)
end
end
return nothing
end
if ymws.ALG == SU3alg
@timeit "Randomize SU(3) algebra field" begin
m = CUDA.randn(ymws.PRC, lp.bsz,lp.ndim,8,lp.rsz)
CUDA.@sync begin
CUDA.@cuda threads=lp.bsz blocks=lp.rsz krnl_assign_SU3!(f,m,lp)
end
end
return nothing
end

View file

@ -63,6 +63,7 @@ end
function flw_euler(U, ns, eps, c0, lp::SpaceParm, ymws::YMworkspace; add_zth=false)
@timeit "Integrating flow equations (Euler)" begin
for i in 1:ns
force_gauge(ymws, U, c0, lp)
if add_zth
@ -70,12 +71,14 @@ function flw_euler(U, ns, eps, c0, lp::SpaceParm, ymws::YMworkspace; add_zth=fal
end
U .= expm.(U, ymws.frc1, 2*eps)
end
end
return nothing
end
function flw_rk3(U, ns, eps, c0, lp::SpaceParm, ymws::YMworkspace; add_zth=false)
@timeit "Integrating flow equations (RK3)" begin
for i in 1:ns
e0 = eps/2
force_gauge(ymws, U, c0, lp)
@ -102,6 +105,7 @@ function flw_rk3(U, ns, eps, c0, lp::SpaceParm, ymws::YMworkspace; add_zth=false
ymws.mom .= e1.*ymws.frc1 .- ymws.mom
U .= expm.(U, ymws.mom)
end
end
return nothing
end

View file

@ -18,14 +18,18 @@ Returns the value of the gauge plaquette action for the configuration U. The par
function gauge_action(U, lp::SpaceParm, gp::GaugeParm{T}, ymws::YMworkspace{T}) where T <: AbstractFloat
if abs(gp.c0-1) < 1.0E-10
@timeit "Wilson gauge action" begin
CUDA.@sync begin
CUDA.@cuda threads=lp.bsz blocks=lp.rsz krnl_plaq!(ymws.cm, U, lp)
end
end
else
@timeit "Improved gauge action" begin
CUDA.@sync begin
CUDA.@cuda threads=lp.bsz blocks=lp.rsz krnl_impr!(ymws.cm, U, gp.c0, (1-gp.c0)/8, lp)
end
end
end
S = gp.beta*( prod(lp.iL)*lp.npls*(gp.c0 + (1-gp.c0)/8) -
CUDA.mapreduce(real, +, ymws.cm)/gp.ng )
@ -34,22 +38,28 @@ end
function plaquette(U, lp::SpaceParm, gp::GaugeParm, ymws::YMworkspace)
@timeit "Plaquette measurement" begin
CUDA.@sync begin
CUDA.@cuda threads=lp.bsz blocks=lp.rsz krnl_plaq!(ymws.cm, U, lp)
end
end
return CUDA.mapreduce(real, +, ymws.cm)/(prod(lp.iL)*lp.npls)
end
function hamiltonian(mom, U, lp, gp, ymws)
@timeit "Computing Hamiltonian" begin
K = CUDA.mapreduce(norm2, +, mom)/2
V = gauge_action(U, lp, gp, ymws)
end
return K+V
end
function HMC!(U, eps, ns, lp::SpaceParm, gp::GaugeParm, ymws::YMworkspace{T}; noacc=false) where T
@timeit "HMC trayectory" begin
int = omf4(T, eps, ns)
ymws.U1 .= U
@ -74,11 +84,14 @@ function HMC!(U, eps, ns, lp::SpaceParm, gp::GaugeParm, ymws::YMworkspace{T}; no
end
end
end
return dh, acc
end
function MD!(mom, U, int::IntrScheme{NI, T}, lp::SpaceParm, gp::GaugeParm{T}, ymws::YMworkspace{T}) where {NI, T <: AbstractFloat}
@timeit "MD evolution" begin
ee = int.eps*gp.beta/gp.ng
force_gauge(ymws, U, gp.c0, lp)
mom .= mom .+ (int.r[1]*ee) .* ymws.frc1
@ -101,6 +114,7 @@ function MD!(mom, U, int::IntrScheme{NI, T}, lp::SpaceParm, gp::GaugeParm{T}, ym
k += off
end
end
end
return nothing
end

View file

@ -1,4 +1,4 @@
using CUDA, Logging, StructArrays, Random
using CUDA, Logging, StructArrays, Random, TimerOutputs
CUDA.allowscalar(false)
import Pkg
@ -7,7 +7,7 @@ Pkg.activate("/lhome/ific/a/alramos/s.images/julia/workspace/LatticeGPU")
using LatticeGPU
# Set lattice/block size
lp = SpaceParm{4}((32,32,32,32), (4,4,4,4))
lp = SpaceParm{4}((16,16,16,16), (4,4,4,4))
println("Space Parameters: ", lp)
# Seed RNG
@ -93,5 +93,6 @@ println("Time for 100 steps of RK3 flow integrator: ")
println("Action: ", gauge_action(U, lp, gp, ymws))
println("## END improved action/flow measurements")
print_timer(linechars = :ascii)
println("END")