Updated tests

This commit is contained in:
Fernando P. Panadero 2024-11-20 12:43:11 +01:00
parent 263ae07361
commit 3a251dd1b8
7 changed files with 46 additions and 37 deletions

View file

@ -1,13 +1,8 @@
using CUDA
using CUDA, LatticeGPU
using Pkg
Pkg.activate("/home/fperez/Git/LGPU_fork_ferflow")
using LatticeGPU
lp = SpaceParm{4}((4,4,4,4),(2,2,2,2),0,(0,0,0,0,0,0));
println(" # Consistency condition for backflow")
lp = SpaceParm{4}((16,16,16,16), (4,4,4,4), BC_PERIODIC, (0,0,0,0,0,0))
pso = scalar_field(Spinor{4,SU3fund{Float64}},lp);
psi = scalar_field(Spinor{4,SU3fund{Float64}},lp);
psi2 = scalar_field(Spinor{4,SU3fund{Float64}},lp);
@ -19,24 +14,27 @@ int = wfl_rk3(Float64, 0.01, 1.0)
gp = GaugeParm{Float64}(SU3{Float64},6.0,1.0,(1.0,0.0),(0.0,0.0),lp.iL)
dpar = DiracParam{Float64}(SU3fund,1.3,0.9,(1.0,1.0,1.0,1.0),0.0)
dpar = DiracParam{Float64}(SU3fund,1.3,0.9,(1.0,1.0,1.0,1.0),0.0,0.0)
randomize!(ymws.mom, lp, ymws)
U = exp.(ymws.mom);
pfrandomize!(psi,lp)
for L in 4:19
for L in 10:20:210
pso .= psi
V = Array(U)
a,b = flw_adapt(U, psi, int, L*int.eps, gp,dpar, lp, ymws,dws)
#a,b = flw_adapt(U, psi, int, L*int.eps, gp,dpar, lp, ymws,dws)
flw(U, psi, int, L,int.eps, gp,dpar, lp, ymws,dws)
# for i in 1:a
# flw(U, psi, int, 1 ,b[i], gp, dpar, lp, ymws, dws)
# end
pfrandomize!(psi2,lp)
foo = sum(dot.(psi,psi2))# field_dot(psi,psi2,sumf,lp)
foo = sum(dot.(psi,psi2))
copyto!(U,V);
backflow(psi2,U,L*int.eps,7,gp,dpar,lp, ymws,dws)
println("Error:",(sum(dot.(pso,psi2))-foo)/foo)
backflow(psi2,U,L*int.eps,20,gp,dpar,lp, ymws,dws)
println("# Consistency backflow test for t=",L*int.eps)
println("Relative error:",abs((sum(dot.(pso,psi2))-foo)/foo))
psi .= pso
end

View file

@ -3,13 +3,14 @@ using LatticeGPU, CUDA, TimerOutputs
#Test for the relation K(t,y;0,n)^+ Dw(n|m)^{-1} e^(ipm) = D(p)^{-1} exp(4t sin^2(p/2)) e^{ipn} with a given momenta (if p=0 its randomized), spin and color
#Kernel en 1207.2096
println(" # Free fermion propagator for backflow")
@timeit "Plw backflow test" begin
function Dwpw_test(;p=0,s=1,c=1)
lp = SpaceParm{4}((16,16,16,16), (4,4,4,4), 0, (0,0,0,0,0,0))
gp = GaugeParm{Float64}(SU3{Float64}, 6.0, 1.0)
dpar = DiracParam{Float64}(SU3fund,1.3,0.0,(1.0,1.0,1.0,1.0),0.0)
dpar = DiracParam{Float64}(SU3fund,1.3,0.0,(1.0,1.0,1.0,1.0),0.0,0.0)
dws = DiracWorkspace(SU3fund,Float64,lp);
ymws = YMworkspace(SU3,Float64,lp);
@ -89,9 +90,7 @@ using LatticeGPU, CUDA, TimerOutputs
g5Dw!(prop,U,pwave,dpar,dws,lp)
CG!(prop,U,DwdagDw!,dpar,lp,dws,10000,1.0e-14)
for _ in 1:Nsteps
backflow(U,prop,1,int.eps,gp,dpar,lp, ymws,dws)
end
backflow(prop,U,Nsteps*int.eps,20,gp,dpar,lp, ymws,dws)
end
@ -103,15 +102,15 @@ using LatticeGPU, CUDA, TimerOutputs
begin
dif = 0.0
global diff = 0.0
for i in 1:3 for j in 1:4
dif += Dwpw_test(c=i,s=j)
global diff += Dwpw_test(c=i,s=j)
end end
if dif < 1.0e-5
print("Backflow_tl test passed with average error ", dif/12,"!\n")
if diff < 1.0e-5
print("Backflow_tl test passed with average error ", diff/12,"\n")
else
error("Backflow_tl test failed with difference: ",dif,"\n")
error("Backflow_tl test failed with difference: ",diff,"\n")
end

View file

@ -1,15 +1,16 @@
using LatticeGPU, CUDA, TimerOutputs
#Test for the relation K(t,y;0,n) Dw(n|m)^{-1} e^(ipm) = D(p)^{-1} exp(-4t sin^2(p/2)) e^{ipn} with a given momenta (if p=0 its randomized), spin and color
#Kernel en 1207.2096
#Kernel from 1207.2096
println(" # Free fermion propagator for frontflow")
@timeit "Plw flow test" begin
function Dwpw_test(;p=0,s=1,c=1)
lp = SpaceParm{4}((16,16,16,16), (4,4,4,4), 0, (0,0,0,0,0,0))
gp = GaugeParm{Float64}(SU3{Float64}, 6.0, 1.0)
dpar = DiracParam{Float64}(SU3fund,1.3,0.0,(1.0,1.0,1.0,1.0),0.0)
dpar = DiracParam{Float64}(SU3fund,1.3,0.0,(1.0,1.0,1.0,1.0),0.0,0.0)
dws = DiracWorkspace(SU3fund,Float64,lp);
ymws = YMworkspace(SU3,Float64,lp);
@ -103,15 +104,15 @@ using LatticeGPU, CUDA, TimerOutputs
begin
dif = 0.0
global diff = 0.0
for i in 1:3 for j in 1:4
dif += Dwpw_test(c=i,s=j)
global diff += Dwpw_test(c=i,s=j)
end end
if dif < 1.0e-4
print("Flow_tl test passed with average error ", dif/12,"!\n")
if diff < 1.0e-4
print("Flow_tl test passed with average error ", diff/12,"\n")
else
error("Flow_tl test failed with difference: ",dif,"\n")
error("Flow_tl test failed with difference: ",diff,"\n")
end

View file

@ -2,6 +2,8 @@ using LatticeGPU
using CUDA
using TimerOutputs
println(" # Free solution for SF correlation functions")
@timeit "fA_fP test" begin
@ -115,7 +117,7 @@ using TimerOutputs
elseif difP > 1.0e-15
error("fP test failed with error ", difP)
else
print("fA & fP tests passed with errors: ", difA," and ",difP,"!\n")
print("fA & fP tests passed with errors: ", difA," and ",difP,"\n")
end
end

View file

@ -2,6 +2,8 @@ using LatticeGPU, CUDA, TimerOutputs
#Test for the relation Dw(n|m)^{-1} e^(ipm) = D(p)^{-1} e^{ipn} with a given momenta (if p=0 its randomized), spin and color
println(" # Test for free fermion propagator")
@timeit "Plw test" begin
function Dwpw_test(;p=0,s=1,c=1)
@ -84,12 +86,12 @@ end
dif = sum(norm2.(prop - prop_th))
if dif > 1.0e-15
if dif > 1.0e-7
error("Dwpl test for s=",s,", c=",c," failed with difference: ",dif,"\n")
end
return dif
return sqrt(dif)
end
@ -101,8 +103,8 @@ for i in 1:3 for j in 1:4
global diff += Dwpw_test(c=i,s=j)
end end
if diff < 1.0e-15
print("Dwpl test passed with average error ", diff/12,"!\n")
if diff < 1.0e-7
print("Dwpl test passed with average error ", diff/12,"\n")
else
error("Dwpl test failed with difference: ",diff,"\n")
end

View file

@ -2,6 +2,9 @@ using CUDA, LatticeGPU, TimerOutputs
#Check that Dw ( (DwdagDw)^{-1} g5 Dw g5 ) psi = psi for random fields
println(" # Test for the consistency of the solver")
@timeit "Rand solver test" begin
@timeit "Generate random fields" begin
@ -46,7 +49,7 @@ res = sum(norm2.(rpsi-dws.sp))
if res < 1.0e-6
print("Drand test passed with ",res,"% error!\n")
print("Drand test passed with ",res,"% error\n")
else
error("Drand test failed with difference: ",res,"\n")

View file

@ -1,6 +1,10 @@
include("SAD/test_sad.jl")
#include("SAD/test_sad.jl")
include("flow/test_adapt.jl")
include("dirac/test_fp_fa.jl")
include("dirac/test_solver_plw.jl")
include("dirac/test_solver_rand.jl")
include("dirac/test_flow_tl.jl")
include("dirac/test_backflow_tl.jl")
include("dirac/test_backflow.jl")