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

@ -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,8 +117,8 @@ 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,
re21 + im*co21, re22 + im*co22, re23 + im*co23))
(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
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