Now can run on existing configs.

parent bd1d44b4
...@@ -22,11 +22,10 @@ include("./src/mc.jl") ...@@ -22,11 +22,10 @@ include("./src/mc.jl")
global log_file = open("./output/"*params["Run"]["name"]*".log","w+") global log_file = open("./output/"*params["Run"]["name"]*".log","w+")
write_log() write_log()
load_fields() load_fields()
therm_or_readlist()
end end
@timeit "Thermalization" thermalize() while RUN_ON
while isfile("run_on")
@timeit "HMC" Gauge_update() @timeit "HMC" Gauge_update()
......
...@@ -29,7 +29,7 @@ function parse_commandline() ...@@ -29,7 +29,7 @@ function parse_commandline()
arg_type = String arg_type = String
"-c" "-c"
help = "Gauge configuration file" help = "Gauge configuration list file"
arg_type = String arg_type = String
"--cern" "--cern"
...@@ -67,6 +67,7 @@ function load_structs() ...@@ -67,6 +67,7 @@ function load_structs()
global N_noise = params["Measurements"]["N_noise"] global N_noise = params["Measurements"]["N_noise"]
global MCid = 0 global MCid = 0
global Nmc_acc = 0 global Nmc_acc = 0
global RUN_ON = true
return nothing return nothing
end end
...@@ -154,27 +155,6 @@ function save_data() ...@@ -154,27 +155,6 @@ function save_data()
end end
"""
function load_gauge_field()
Returns the gauge field and computes the Csw term
"""
function load_gauge_field()
if !parsed_args["cern"]
println(log_file,"\nReading gauge field with LGPU native convention from: ", parsed_args["c"], "...")
U,_ = read_cnfg(parsed_args["c"])
else
println(log_file,"\nReading gauge field with CERN convention from: ", parsed_args["c"], "...")
U = read_cnfg_cern(parsed_args["c"],lp)
end
f = open(parsed_args["c"],"r")
println(log_file,"MD5 checksum of gauge config: ",bytes2hex(md5(f)),"\n")
close(f)
Csw!(dws, U, gp, lp)
return U
end
function read_cnfg_cern(path::String,lp::SpaceParm) function read_cnfg_cern(path::String,lp::SpaceParm)
Ucpu = Array{SU3{Float64}, 3}(undef, lp.bsz, lp.ndim, lp.rsz) Ucpu = Array{SU3{Float64}, 3}(undef, lp.bsz, lp.ndim, lp.rsz)
......
...@@ -5,20 +5,40 @@ using ArgParse ...@@ -5,20 +5,40 @@ using ArgParse
using CUDA using CUDA
function thermalize() function therm_or_readlist()
println(log_file,"\n Starting simulation\n") println(log_file,"\n Starting simulation\n")
println(log_file,"Thermalizing...") if parsed_args["c"] == nothing
flush(log_file) println(log_file,"Thermalizing...")
flush(log_file)
@timeit "Thermalization" for _ in 1:params["HMC"]["nth"]
HMC!(U,intsch,lp,gp,ymws)
end
for _ in 1:params["HMC"]["nth"] else
HMC!(U,intsch,lp,gp,ymws) println(log_file,"Loading gauge configurations from "*string(parsed_args["c"]))
read_config_list()
end end
f = open("RUN_ON_"*params["Run"]["name"],"w+")
close(f)
return nothing return nothing
end end
function Gauge_update() function Gauge_update()
if parsed_args["c"] == nothing
Gauge_update_hmc()
global RUN_ON = isfile("RUN_ON_"*params["Run"]["name"])
else
load_gauge_field()
global RUN_ON = (isfile("RUN_ON_"*params["Run"]["name"]) && CONFIG_LIST[MCid+1] != "")
end
return nothing
end
function Gauge_update_hmc()
println(log_file,"Performing "*string(params["HMC"]["dmeas"])*" HMC steps...") println(log_file,"Performing "*string(params["HMC"]["dmeas"])*" HMC steps...")
flush(log_file) flush(log_file)
...@@ -42,5 +62,48 @@ function Gauge_update() ...@@ -42,5 +62,48 @@ function Gauge_update()
flush(log_file) flush(log_file)
return nothing return nothing
end
function read_config_list()
global CONFIG_LIST = Vector{String}(undef,0)
f = open(parsed_args["c"],"r")
while true
push!(CONFIG_LIST,"./cnfg/"*readline(f))
CONFIG_LIST[end] == "" ? break : nothing
end
println(log_file,"Read ", length(CONFIG_LIST)-1, " config names for analisis")
return nothing
end
"""
function load_gauge_field()
Loads the gauge field and computes the Csw term
"""
function load_gauge_field()
global MCid = MCid + 1
if !parsed_args["cern"]
println(log_file,"\nReading gauge field with LGPU native convention: ", CONFIG_LIST[MCid], "...")
global U,_ = read_cnfg(CONFIG_LIST[MCid])
else
println(log_file,"\nReading gauge field with CERN convention: ", CONFIG_LIST[MCid], "...")
global U = read_cnfg_cern(CONFIG_LIST[MCid],lp)
end
println(log_file,"Updated to Gauge configuration n"*string(MCid))
f = open(CONFIG_LIST[MCid],"r")
println(log_file,"MD5 checksum of gauge config: ",bytes2hex(md5(f)),"\n")
close(f)
println(log_file,"Plaq = ", plaquette(U, lp, gp, ymws))
println(log_file,"Qtop = ", Qtop(U, gp, lp, ymws))
Csw!(dws,U,gp,lp)
U_CPU .= Array(U)
flush(log_file)
return nothing
end end
...@@ -141,8 +141,6 @@ end ...@@ -141,8 +141,6 @@ end
""" """
function two_pt_rnd() function two_pt_rnd()
......
using LatticeGPU # using LatticeGPU
using ADerrors using ADerrors
using BDIO using BDIO
...@@ -23,7 +23,7 @@ function read_ff(name::String) ...@@ -23,7 +23,7 @@ function read_ff(name::String)
BDIO_read(file, th) BDIO_read(file, th)
BDIO_read(file, nflow) BDIO_read(file, nflow)
flow_times=Vector{Float64}(undef,nflow[1]) flow_times=Vector{Float64}(undef,nflow[1])
BDIO_read(file, flow_times) nflow[1] > 0 ? BDIO_read(file, flow_times) : nothing
BDIO_read(file, N_noise) BDIO_read(file, N_noise)
N_noise = N_noise[1] N_noise = N_noise[1]
...@@ -103,11 +103,11 @@ end ...@@ -103,11 +103,11 @@ end
""" """
function uwff(file::String) function uwff(file::String)
Loads in the variables 'pp_corr','ap_corr','pp_corr_t','ap_corr_t' and 'Sigma' the corresponding Loads in the variables 'Epft', 'pp_corr', 'ap_corr', 'pp_corr_t','ap_corr_t', 'Sigma' and 'Sigma_cfl' the corresponding
'uwreal' quantities. The indices are, when corresponding, eucliden time and flow times 'uwreal' quantities. The indices are, when corresponding, eucliden time and flow times
""" """
function uwff(file::String) function uwff(file::String)
Eoft_mc,pp_corr_mc,ap_corr_mc,pp_corr_t_mc,ap_corr_t_mc,Sigma_mc,Phat_t_mc = read_ff(file) Eoft_mc,pp_corr_mc,ap_corr_mc,pp_corr_t_mc,ap_corr_t_mc,Sigma_mc,Sigma_cfl_mc,Phat_t_mc = read_ff(file)
runame = String(split(split(file,"/")[end],".")[1]) runame = String(split(split(file,"/")[end],".")[1])
T = size(pp_corr_mc)[2] T = size(pp_corr_mc)[2]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment