Added MD5 and BDIO

This commit is contained in:
Fernando P. Panadero 2024-02-23 12:32:28 +01:00
commit b7601bb6af
2 changed files with 62 additions and 3 deletions

View file

@ -4,6 +4,8 @@ using TimerOutputs
using ArgParse using ArgParse
using CUDA using CUDA
using InteractiveUtils using InteractiveUtils
using BDIO
using MD5
include("./src/io.jl") include("./src/io.jl")
include("./src/meas.jl") include("./src/meas.jl")
@ -26,10 +28,10 @@ end
@timeit "Correlators contractions" compute_correlators() @timeit "Correlators contractions" compute_correlators()
@timeit "Correlators saving" save_correlators()
print("\n\n") print("\n\n")
print_timer(log_file) print_timer(log_file)
flush(log_file) flush(log_file)
close(log_file) close(log_file)

View file

@ -1,8 +1,10 @@
using LatticeGPU using LatticeGPU
using TOML using TOML
using TimerOutputs
using ArgParse using ArgParse
using CUDA using CUDA
using BDIO
using InteractiveUtils
using MD5
""" """
@ -51,10 +53,14 @@ function load_gauge_field()
println(log_file,"\nReading gauge field with LGPU native convention from: ", parsed_args["c"], "...") println(log_file,"\nReading gauge field with LGPU native convention from: ", parsed_args["c"], "...")
U,_ = read_cnfg(parsed_args["c"]) U,_ = read_cnfg(parsed_args["c"])
else else
println(log_file,"\nReading gauge field with CERN convention from: ", parsed_args["c"], "...\n") println(log_file,"\nReading gauge field with CERN convention from: ", parsed_args["c"], "...")
U = read_cnfg_cern(parsed_args["c"],lp) U = read_cnfg_cern(parsed_args["c"],lp)
end 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) Csw!(dws, U, gp, lp)
return U return U
end end
@ -176,3 +182,54 @@ function write_log()
return nothing return nothing
end end
function save_correlators()
ihdr = [convert(Int32,1708683512)]
fname = "./output"*params["Run"]["name"]*".bdio"
if isfile(fname)
fb = BDIO_open(fname, "a")
println(log_file,"Appending output to "*fname)
else
fb = BDIO_open(fname, "w", "BDIO output from sfcf.jl")
println(log_file,"Creating new BDIO output file "*fname)
BDIO_start_record!(fb, BDIO_BIN_GENERIC, 14)
BDIO_write!(fb, ihdr)
BDIO_write_hash!(fb)
BDIO_start_record!(fb, BDIO_BIN_GENERIC, 1)
BDIO_write!(fb, [convert(Int32, 4)])
BDIO_write!(fb, [convert(Int32, lp.iL[i]) for i in 1:4])
BDIO_write!(fb, [convert(Int32, lp.ntw[i]) for i in 1:6])
BDIO_write!(fb, [dpar.m0, dpar.csw, dpar.tm, dpar.ct])
BDIO_write!(fb, [dpar.th[i] for i in 1:4])
BDIO_write_hash!(fb)
end
BDIO_start_record!(fb, BDIO_BIN_GENERIC, 8)
BDIO_write!(fb,basename(parsed_args["c"]))
fg = open(parsed_args["c"],"r")
BDIO_write!(fb,bytes2hex(md5(fg)))
close(fg)
BDIO_write!(fb,fP)
BDIO_write!(fb,fA)
BDIO_write!(fb,[f1])
BDIO_write!(fb,gP)
BDIO_write!(fb,gA)
BDIO_write!(fb,kV)
BDIO_write!(fb,lV)
BDIO_write!(fb,[k1])
BDIO_write!(fb,kT)
BDIO_write!(fb,lT)
BDIO_write_hash!(fb)
BDIO_close!(fb)
return nothing
end