Log file and gauge measurements

This commit is contained in:
Fernando P. Panadero 2024-02-22 12:24:42 +01:00
commit 0a33c84c10
10 changed files with 212 additions and 195 deletions

View file

@ -1,6 +1,6 @@
[Run]
user = "Lattice user"
name = "Template run"
user = "Lattice_user"
name = "Template_run"
[Space]
size = [8,8,8,8]

View file

@ -1,8 +0,0 @@
1 0.0 + 0.0im
2 -31.04305231567254 + 2.1252056646610396e-18im
3 -1.4671112666898436 - 9.031488800098977e-20im
4 -0.06537188111892875 + 2.716461131624143e-21im
5 -0.002933795526834015 - 2.365736551901659e-22im
6 -0.00013043629270008468 + 1.8495241508802853e-23im
7 -5.875876629837171e-6 + 4.476186102841274e-25im
8 -2.726581392340069e-7 + 6.563322731438818e-27im

View file

@ -1,8 +0,0 @@
1 0.0 + 0.0im
2 73.67395934956765 + 0.0im
3 3.3887421125734036 + 0.0im
4 0.15144928799903828 + 0.0im
5 0.006828696539887742 + 0.0im
6 0.0003023150684989386 + 0.0im
7 1.361849306449979e-5 + 0.0im
8 6.375793198531621e-7 + 0.0im

View file

@ -1,8 +0,0 @@
1 0.0 + 0.0im
2 -2.7310053780937123e-7 - 4.550149701314796e-27im
3 -5.8143401218682364e-6 + 1.6206358436860467e-25im
4 -0.00013056821426116682 - 5.932435955653745e-24im
5 -0.0029261383446798125 + 7.222320723353623e-23im
6 -0.06619259853464403 - 3.22931311140702e-21im
7 -1.4692707713700914 + 2.5710096927128185e-19im
8 -30.89429497223169 - 3.0001906991747318e-18im

View file

@ -1,8 +0,0 @@
1 0.0 + 0.0im
2 6.435062273546668e-7 + 0.0im
3 1.3621688998858976e-5 + 0.0im
4 0.00030680086560982034 + 0.0im
5 0.006857460528564787 + 0.0im
6 0.1539180922119846 + 0.0im
7 3.3981870666381786 + 0.0im
8 73.17751168291873 + 0.0im

21
sfcf.jl
View file

@ -5,15 +5,21 @@ using ArgParse
using CUDA
include("./src/io.jl")
include("./src/props.jl")
include("./src/meas.jl")
include("./src/corr.jl")
@timeit "Input reading" begin
read_input()
load_structs()
U = load_gauge_field()
@timeit "Imput reading and space allocation" begin
read_input()
load_structs()
U = vector_field(SU3{Float64}, lp)
end
log_file = open("./output/"*params["Run"]["name"]*".log","w+")
write_log()
@timeit "Gauge field reading" U .= load_gauge_field()
@timeit "Gauge measurements" gauge_meas()
@timeit "Propagator computation" compute_propagators()
@ -21,4 +27,7 @@ end
print("\n\n")
print_timer()
print_timer(log_file)
flush(log_file)
close(log_file)

View file

@ -20,7 +20,6 @@ function fP_fun()
return cf
end
function fA_fun()
cf = Vector{Complex{Float64}}(undef,lp.iL[4])
for t in 1:lp.iL[4]
@ -34,7 +33,6 @@ function fA_fun()
return cf
end
function gP_fun()
cf = Vector{Complex{Float64}}(undef,lp.iL[4])
for t in 1:lp.iL[4]
@ -47,7 +45,6 @@ function gP_fun()
return cf
end
function gA_fun()
cf = Vector{Complex{Float64}}(undef,lp.iL[4])
for t in 1:lp.iL[4]
@ -78,7 +75,6 @@ function kV_fun()
return cf
end
function lV_fun()
cf = Vector{Complex{Float64}}(undef,lp.iL[4])
for t in 1:lp.iL[4]
@ -96,7 +92,6 @@ function lV_fun()
return cf
end
function kT_fun()
cf = Vector{Complex{Float64}}(undef,lp.iL[4])
for t in 1:lp.iL[4]
@ -114,7 +109,6 @@ function kT_fun()
return cf
end
function lT_fun()
cf = Vector{Complex{Float64}}(undef,lp.iL[4])
for t in 1:lp.iL[4]
@ -145,76 +139,82 @@ k1_fun() = (dot(C11,dmul(Gamma{6},imm(C12))) + dot(C11,dmul(Gamma{7},-C12)) + do
function compute_correlators()
println("Computing correlators")
println(log_file,"\nComputing correlators")
println("Computing f1...")
file = open("./output/"*basename(parsed_args["c"])*".f1","w+")
println(log_file,"\nComputing f1...")
global f1 = f1_fun()
println(file,f1)
flush(file)
close(file)
println(log_file,"f1 = \n")
println(log_file,f1)
flush(log_file)
println("Computing k1...")
file = open("./output/"*basename(parsed_args["c"])*".k1","w+")
println(log_file,"\nComputing k1...")
global k1 = k1_fun()
println(file,k1)
flush(file)
close(file)
println(log_file,"k1 = \n")
println(log_file,k1)
flush(log_file)
println("Computing fP...")
file = open("./output/"*basename(parsed_args["c"])*".fP","w+")
println(log_file,"\nComputing fP...")
global fP = fP_fun()
println(file,fP)
flush(file)
close(file)
println(log_file,"fP = \n")
for i in 1:lp.iL[4]
println(log_file,fP[i])
end
flush(log_file)
println("Computing fA...")
file = open("./output/"*basename(parsed_args["c"])*".fA","w+")
println(log_file,"\nComputing fA...")
global fA = fA_fun()
println(file,fA)
flush(file)
close(file)
println(log_file,"fA = \n")
for i in 1:lp.iL[4]
println(log_file,fA[i])
end
flush(log_file)
println("Computing gP...")
file = open("./output/"*basename(parsed_args["c"])*".gP","w+")
println(log_file,"\nComputing gP...")
global gP = gP_fun()
println(file,gP)
flush(file)
close(file)
println(log_file,"gP = \n")
for i in 1:lp.iL[4]
println(log_file,gP[i])
end
flush(log_file)
println("Computing gA...")
file = open("./output/"*basename(parsed_args["c"])*".gA","w+")
println(log_file,"\nComputing gA...")
global gA = gA_fun()
println(file,gA)
flush(file)
close(file)
println(log_file,"gA = \n")
for i in 1:lp.iL[4]
println(log_file,gA[i])
end
flush(log_file)
println("Computing kV...")
file = open("./output/"*basename(parsed_args["c"])*".kV","w+")
println(log_file,"\nComputing kV...")
global kV = kV_fun()
println(file,kV)
flush(file)
close(file)
println(log_file,"kV = \n")
for i in 1:lp.iL[4]
println(log_file,kV[i])
end
flush(log_file)
println("Computing lV...")
file = open("./output/"*basename(parsed_args["c"])*".lV","w+")
println(log_file,"\nComputing lV...")
global lV = lV_fun()
println(file,lV)
flush(file)
close(file)
println(log_file,"lV = \n")
for i in 1:lp.iL[4]
println(log_file,lV[i])
end
flush(log_file)
println("Computing kT...")
file = open("./output/"*basename(parsed_args["c"])*".kT","w+")
println(log_file,"\nComputing kT...")
global kT = kT_fun()
println(file,kT)
flush(file)
close(file)
println(log_file,"kT = \n")
for i in 1:lp.iL[4]
println(log_file,kT[i])
end
flush(log_file)
println("Computing lT...")
file = open("./output/"*basename(parsed_args["c"])*".lT","w+")
println(log_file,"\nComputing lT...")
global lT = lT_fun()
println(file,lT)
flush(file)
close(file)
println(log_file,"lT = \n")
for i in 1:lp.iL[4]
println(log_file,lT[i])
end
flush(log_file)
end

View file

@ -12,8 +12,7 @@ Stores as global variables 'parsed_args' (info from the command line) and 'param
"""
function read_input()
global parsed_args = parse_commandline()
println("--------------------------------------------------")
println("Reading input file from:", parsed_args["i"], "...")
println(log_file,"Reading input file from:", parsed_args["i"], "...")
global params = TOML.parsefile(parsed_args["i"])
return nothing
end
@ -47,22 +46,22 @@ end
function load_gauge_field()
Returns the gauge field and computes the Csw term
"""
function load_gauge_field()
println("Reading gauge field from: ", parsed_args["c"], "...")
if !parsed_args["cern"]
println(log_file,"\nReading gauge field with LGPU native convention from: ", parsed_args["c"], "...\n")
U,_ = read_cnfg(parsed_args["c"])
else
println(log_file,"\nReading gauge field with CERN convention from: ", parsed_args["c"], "...\n")
U = read_cnfg_cern(parsed_args["c"],lp)
end
Csw!(dws, U, gp, lp)
Csw!(dws, U, gp, lp)
return U
end
function read_cnfg_cern(path::String,lp::SpaceParm)
U = vector_field(SU3{Float64}, lp);
Ucpu = Array{SU3{Float64}, 3}(undef, lp.bsz, lp.ndim, lp.rsz)
file = open(path)
for t in 1:lp.iL[4]
for i in 1:lp.iL[1]
@ -118,7 +117,7 @@ function read_cnfg_cern(path::String,lp::SpaceParm)
re33 = read(file,Float64)
co33 = read(file,Float64)
CUDA.@allowscalar (U[f,d,r] = SU3{Float64}(re11 + im*co11, re12 + im*co12, re13 + im*co13,
(Ucpu[f,d,r] = SU3{Float64}(re11 + im*co11, re12 + im*co12, re13 + im*co13,
re21 + im*co21, re22 + im*co22, re23 + im*co23))
end
end
@ -128,7 +127,7 @@ function read_cnfg_cern(path::String,lp::SpaceParm)
length(read(file)) == (prod(lp.iL[1:3])*4*8*9*2) ? nothing : error("File not fully read")
close(file)
return U
return CuArray(Ucpu)
end
"""
@ -144,17 +143,35 @@ function load_structs()
global dws = DiracWorkspace(SU3fund,Float64,lp);
global ymws = YMworkspace(SU3,Float64,lp);
println("Parameters:")
println("Lattice size: ", lp.iL)
println("Phi0 = ", params["Space"]["phi0"])
println("PhiT = ", params["Space"]["phiT"])
println("cG = ", gp.cG[1])
println("kappa = ", params["Fermion"]["kappa"])
println("theta = ", params["Fermion"]["theta"])
println("csw = ", dpar.csw)
println("ct = ", dpar.ct)
println("tolerance = ", params["Solver"]["tolerance"])
println("maxiter = ", params["Solver"]["maxiter"])
return nothing
end
function write_log()
println(log_file,"Running sfcf.jl by ", params["Run"]["user"],". Name of the run: ",params["Run"]["name"])
println(log_file,"")
print(log_file,"Calling: ")
print(log_file,PROGRAM_FILE*" "); for x in ARGS; print(log_file,x*" "); end
println(log_file,"")
println(log_file,"Version info:")
println(log_file,versioninfo())
println(log_file,"")
println(log_file,"Parameters:")
println(log_file,"Lattice size: ", lp.iL)
println(log_file,"Phi0 = ", params["Space"]["phi0"])
println(log_file,"PhiT = ", params["Space"]["phiT"])
println(log_file,"cG = ", gp.cG[1])
println(log_file,"kappa = ", params["Fermion"]["kappa"])
println(log_file,"theta = ", params["Fermion"]["theta"])
println(log_file,"csw = ", dpar.csw)
println(log_file,"ct = ", dpar.ct)
println(log_file,"tolerance = ", params["Solver"]["tolerance"])
println(log_file,"maxiter = ", params["Solver"]["maxiter"])
println(log_file,"")
flush(log_file)
return nothing
end

100
src/meas.jl Normal file
View file

@ -0,0 +1,100 @@
using LatticeGPU
using TOML
using TimerOutputs
using ArgParse
using CUDA
"""
function compute_propagators()
Computes the propagators for the first two components of spin.
The propagators are stored in Acs (t=0 to bulk), Bcs(bulk to t=T) and Ccs(t=0 to t=T)
"""
function compute_propagators()
psi = scalar_field(Spinor{4,SU3fund{Float64}},lp)
println(log_file,"Computing propagators from t=0 to the bulk")
flush(log_file)
niter = bndpropagator!(psi, U, dpar, dws, lp, params["Solver"]["maxiter"], params["Solver"]["tolerance"], 1, 1)
println(log_file,"CG converged for c=1 and s=1 after ",niter," iterations with absolute residue ", CUDA.mapreduce(x -> norm(x), +, dws.sr))
global A11 = Array(psi)
global C11 = bndtobnd(psi, U, dpar, dws, lp)
flush(log_file)
niter = bndpropagator!(psi, U, dpar, dws, lp, params["Solver"]["maxiter"], params["Solver"]["tolerance"], 2, 1)
println(log_file,"CG converged for c=2 and s=1 after ",niter," iterations with absolute residue ", CUDA.mapreduce(x -> norm(x), +, dws.sr))
global A21 = Array(psi)
global C21 = bndtobnd(psi, U, dpar, dws, lp)
flush(log_file)
niter = bndpropagator!(psi, U, dpar, dws, lp, params["Solver"]["maxiter"], params["Solver"]["tolerance"], 3, 1)
println(log_file,"CG converged for c=3 and s=1 after ",niter," iterations with absolute residue ", CUDA.mapreduce(x -> norm(x), +, dws.sr))
global A31 = Array(psi)
global C31 = bndtobnd(psi, U, dpar, dws, lp)
flush(log_file)
niter = bndpropagator!(psi, U, dpar, dws, lp, params["Solver"]["maxiter"], params["Solver"]["tolerance"], 1, 2)
println(log_file,"CG converged for c=1 and s=2 after ",niter," iterations with absolute residue ", CUDA.mapreduce(x -> norm(x), +, dws.sr))
global A12 = Array(psi)
global C12 = bndtobnd(psi, U, dpar, dws, lp)
flush(log_file)
niter = bndpropagator!(psi, U, dpar, dws, lp, params["Solver"]["maxiter"], params["Solver"]["tolerance"], 2, 2)
println(log_file,"CG converged for c=2 and s=2 after ",niter," iterations with absolute residue ", CUDA.mapreduce(x -> norm(x), +, dws.sr))
global A22 = Array(psi)
global C22 = bndtobnd(psi, U, dpar, dws, lp)
flush(log_file)
niter = bndpropagator!(psi, U, dpar, dws, lp, params["Solver"]["maxiter"], params["Solver"]["tolerance"], 3, 2)
println(log_file,"CG converged for c=3 and s=2 after ",niter," iterations with absolute residue ", CUDA.mapreduce(x -> norm(x), +, dws.sr))
global A32 = Array(psi)
global C32 = bndtobnd(psi, U, dpar, dws, lp)
flush(log_file)
println(log_file,"Computing propagators from t=T to the bulk")
niter = Tbndpropagator!(psi, U, dpar, dws, lp, params["Solver"]["maxiter"], params["Solver"]["tolerance"], 1, 1)
println(log_file,"CG converged for c=1 and s=1 after ",niter," iterations with absolute residue ", CUDA.mapreduce(x -> norm(x), +, dws.sr))
global B11 = Array(psi)
flush(log_file)
niter = Tbndpropagator!(psi, U, dpar, dws, lp, params["Solver"]["maxiter"], params["Solver"]["tolerance"], 2, 1)
println(log_file,"CG converged for c=2 and s=1 after ",niter," iterations with absolute residue ", CUDA.mapreduce(x -> norm(x), +, dws.sr))
global B21 = Array(psi)
flush(log_file)
niter = Tbndpropagator!(psi, U, dpar, dws, lp, params["Solver"]["maxiter"], params["Solver"]["tolerance"], 3, 1)
println(log_file,"CG converged for c=3 and s=1 after ",niter," iterations with absolute residue ", CUDA.mapreduce(x -> norm(x), +, dws.sr))
global B31 = Array(psi)
flush(log_file)
niter = Tbndpropagator!(psi, U, dpar, dws, lp, params["Solver"]["maxiter"], params["Solver"]["tolerance"], 1, 2)
println(log_file,"CG converged for c=1 and s=2 after ",niter," iterations with absolute residue ", CUDA.mapreduce(x -> norm(x), +, dws.sr))
global B12 = Array(psi)
flush(log_file)
niter = Tbndpropagator!(psi, U, dpar, dws, lp, params["Solver"]["maxiter"], params["Solver"]["tolerance"], 2, 2)
println(log_file,"CG converged for c=2 and s=2 after ",niter," iterations with absolute residue ", CUDA.mapreduce(x -> norm(x), +, dws.sr))
global B22 = Array(psi)
flush(log_file)
niter = Tbndpropagator!(psi, U, dpar, dws, lp, params["Solver"]["maxiter"], params["Solver"]["tolerance"], 3, 2)
println(log_file,"CG converged for c=3 and s=2 after ",niter," iterations with absolute residue ", CUDA.mapreduce(x -> norm(x), +, dws.sr))
global B32 = Array(psi)
println(log_file,"\n")
flush(log_file)
return nothing
end
function gauge_meas()
println(log_file,"\nGauge meassurements:")
println(log_file,"Plaquette: ", plaquette(U, lp, gp, ymws))
println(log_file,"Topological charge: ", Qtop(U, gp, lp, ymws))
println(log_file,"SF coupling (dS/deta): ",sfcoupling(U, lp, gp, ymws)[1])
flush(log_file)
return nothing
end

View file

@ -1,77 +0,0 @@
using LatticeGPU
using TOML
using TimerOutputs
using ArgParse
using CUDA
"""
function compute_propagators()
Computes the propagators for the first two components of spin.
The propagators are stored in Acs (t=0 to bulk), Bcs(bulk to t=T) and Ccs(t=0 to t=T)
"""
function compute_propagators()
println("--------------------------------------------------")
psi = scalar_field(Spinor{4,SU3fund{Float64}},lp)
println("Computing propagators from t=0 to the bulk")
niter = bndpropagator!(psi, U, dpar, dws, lp, params["Solver"]["maxiter"], params["Solver"]["tolerance"], 1, 1)
println("CG converged for c=1 and s=1 after ",niter," iterations with absolute residue ", CUDA.mapreduce(x -> norm(x), +, dws.sr))
global A11 = Array(psi)
global C11 = bndtobnd(psi, U, dpar, dws, lp)
niter = bndpropagator!(psi, U, dpar, dws, lp, params["Solver"]["maxiter"], params["Solver"]["tolerance"], 2, 1)
println("CG converged for c=2 and s=1 after ",niter," iterations with absolute residue ", CUDA.mapreduce(x -> norm(x), +, dws.sr))
global A21 = Array(psi)
global C21 = bndtobnd(psi, U, dpar, dws, lp)
niter = bndpropagator!(psi, U, dpar, dws, lp, params["Solver"]["maxiter"], params["Solver"]["tolerance"], 3, 1)
println("CG converged for c=3 and s=1 after ",niter," iterations with absolute residue ", CUDA.mapreduce(x -> norm(x), +, dws.sr))
global A31 = Array(psi)
global C31 = bndtobnd(psi, U, dpar, dws, lp)
niter = bndpropagator!(psi, U, dpar, dws, lp, params["Solver"]["maxiter"], params["Solver"]["tolerance"], 1, 2)
println("CG converged for c=1 and s=2 after ",niter," iterations with absolute residue ", CUDA.mapreduce(x -> norm(x), +, dws.sr))
global A12 = Array(psi)
global C12 = bndtobnd(psi, U, dpar, dws, lp)
niter = bndpropagator!(psi, U, dpar, dws, lp, params["Solver"]["maxiter"], params["Solver"]["tolerance"], 2, 2)
println("CG converged for c=2 and s=2 after ",niter," iterations with absolute residue ", CUDA.mapreduce(x -> norm(x), +, dws.sr))
global A22 = Array(psi)
global C22 = bndtobnd(psi, U, dpar, dws, lp)
niter = bndpropagator!(psi, U, dpar, dws, lp, params["Solver"]["maxiter"], params["Solver"]["tolerance"], 3, 2)
println("CG converged for c=3 and s=2 after ",niter," iterations with absolute residue ", CUDA.mapreduce(x -> norm(x), +, dws.sr))
global A32 = Array(psi)
global C32 = bndtobnd(psi, U, dpar, dws, lp)
println("Computing propagators from t=T to the bulk")
niter = Tbndpropagator!(psi, U, dpar, dws, lp, params["Solver"]["maxiter"], params["Solver"]["tolerance"], 1, 1)
println("CG converged for c=1 and s=1 after ",niter," iterations with absolute residue ", CUDA.mapreduce(x -> norm(x), +, dws.sr))
global B11 = Array(psi)
niter = Tbndpropagator!(psi, U, dpar, dws, lp, params["Solver"]["maxiter"], params["Solver"]["tolerance"], 2, 1)
println("CG converged for c=2 and s=1 after ",niter," iterations with absolute residue ", CUDA.mapreduce(x -> norm(x), +, dws.sr))
global B21 = Array(psi)
niter = Tbndpropagator!(psi, U, dpar, dws, lp, params["Solver"]["maxiter"], params["Solver"]["tolerance"], 3, 1)
println("CG converged for c=3 and s=1 after ",niter," iterations with absolute residue ", CUDA.mapreduce(x -> norm(x), +, dws.sr))
global B31 = Array(psi)
niter = Tbndpropagator!(psi, U, dpar, dws, lp, params["Solver"]["maxiter"], params["Solver"]["tolerance"], 1, 2)
println("CG converged for c=1 and s=2 after ",niter," iterations with absolute residue ", CUDA.mapreduce(x -> norm(x), +, dws.sr))
global B12 = Array(psi)
niter = Tbndpropagator!(psi, U, dpar, dws, lp, params["Solver"]["maxiter"], params["Solver"]["tolerance"], 2, 2)
println("CG converged for c=2 and s=2 after ",niter," iterations with absolute residue ", CUDA.mapreduce(x -> norm(x), +, dws.sr))
global B22 = Array(psi)
niter = Tbndpropagator!(psi, U, dpar, dws, lp, params["Solver"]["maxiter"], params["Solver"]["tolerance"], 3, 2)
println("CG converged for c=3 and s=2 after ",niter," iterations with absolute residue ", CUDA.mapreduce(x -> norm(x), +, dws.sr))
global B32 = Array(psi)
println("--------------------------------------------------")
return nothing
end