mirror of
https://igit.ific.uv.es/alramos/latticegpu.jl.git
synced 2025-05-14 19:23:42 +02:00
Added main test file
This commit is contained in:
parent
eb8ee8ca05
commit
3f49eb877b
1 changed files with 70 additions and 0 deletions
70
src/main/test.jl
Normal file
70
src/main/test.jl
Normal file
|
@ -0,0 +1,70 @@
|
|||
using CUDA, Logging, StructArrays, Random
|
||||
|
||||
CUDA.allowscalar(true)
|
||||
import Pkg
|
||||
Pkg.activate("/lhome/ific/a/alramos/s.images/julia/workspace/LatticeGPU")
|
||||
#Pkg.activate("/home/alberto/code/julia/LatticeGPU")
|
||||
using LatticeGPU
|
||||
|
||||
println(CUDA.device())
|
||||
|
||||
|
||||
GRP = SU3
|
||||
ALG = SU3alg
|
||||
PREC = Float64
|
||||
lp = SpaceParm{4}((32,32,32,32), (4,4,4,2))
|
||||
gp = GaugeParm{PREC}(6.0, (0.0,0.0), 3)
|
||||
|
||||
println("Space Parameters: ", lp)
|
||||
println("Gauge Parameters: ", gp)
|
||||
|
||||
println("Seeding CURAND...")
|
||||
Random.seed!(CURAND.default_rng(), 1234)
|
||||
Random.seed!(1234)
|
||||
|
||||
println("Precision: ", PREC)
|
||||
|
||||
println("Allocating gauge field")
|
||||
U = field(GRP{PREC}, lp)
|
||||
fill!(U, one(GRP{PREC}))
|
||||
|
||||
println("Allocating YM workspace")
|
||||
ymws = YMworkspace(GRP, PREC, lp)
|
||||
|
||||
#CUDA.@sync begin
|
||||
# @device_code_warntype CUDA.@cuda threads=lp.bsz blocks=lp.rsz LatticeGPU.krnl_plaq!(ymws.cm, U, lp)
|
||||
#end
|
||||
|
||||
@time S = gauge_action(U, lp, gp, ymws)
|
||||
@time S = gauge_action(U, lp, gp, ymws)
|
||||
println("Initial Action: ", S)
|
||||
|
||||
|
||||
println(" - Randomize momenta: ")
|
||||
@time randomize!(ymws.frc1, lp, ymws)
|
||||
|
||||
eps = 0.1
|
||||
ns = 10
|
||||
ntot = 3
|
||||
pl = Vector{Float64}()
|
||||
for i in 1:3
|
||||
@time dh, acc = HMC!(U,eps,ns,lp, gp, ymws, noacc=true)
|
||||
println("# HMC: ", acc, " ", dh)
|
||||
push!(pl, plaquette(U,lp, gp, ymws))
|
||||
println("# Plaquette: ", pl[end], "\n")
|
||||
end
|
||||
for i in 1:ntot
|
||||
CUDA.@profile dh, acc = HMC!(U,eps,ns,lp, gp, ymws)
|
||||
println("# HMC: ", acc, " ", dh)
|
||||
push!(pl, plaquette(U,lp, gp, ymws))
|
||||
println("# Plaquette: ", pl[end], "\n")
|
||||
end
|
||||
|
||||
io = open("foo.txt", "w")
|
||||
for i in 1:ntot
|
||||
println(io, pl[i])
|
||||
end
|
||||
|
||||
|
||||
println("END")
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue