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

@ -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