Su2fund pfrandomize and Dw bug fix for periodic

parent 3674df75
...@@ -452,7 +452,7 @@ function Dw_new!(so, U, si, dpar::DiracParam, dws::DiracWorkspace, lp::SpaceParm ...@@ -452,7 +452,7 @@ function Dw_new!(so, U, si, dpar::DiracParam, dws::DiracWorkspace, lp::SpaceParm
if abs(dpar.csw) > 1.0E-10 if abs(dpar.csw) > 1.0E-10
@timeit "Dw_new" begin @timeit "Dw_new" begin
CUDA.@sync begin CUDA.@sync begin
CUDA.@cuda threads=lp.bsz blocks=lp.rsz krnl_Dwimpr_new!(so, U, si, dws.csw, dpar.m0, dpar.th, dpar.csw, dpar.ct, lp) CUDA.@cuda threads=lp.bsz blocks=lp.rsz krnl_Dwimpr_new!(so, U, si, dws.csw, dpar.m0, dpar.th, dpar.csw, lp)
end end
end end
else else
...@@ -611,13 +611,12 @@ function krnl_Dw_new!(so, U, si, m0, th, ct, lp::SpaceParm{4,6,BC_SF_ORBI,D}) wh ...@@ -611,13 +611,12 @@ function krnl_Dw_new!(so, U, si, m0, th, ct, lp::SpaceParm{4,6,BC_SF_ORBI,D}) wh
return nothing return nothing
end end
function g5Dw_new!(so, U, si, dpar::DiracParam, dws::DiracWorkspace, lp::SpaceParm{4,6,B,D}) where {B,D} function g5Dw_new!(so, U, si, dpar::DiracParam, dws::DiracWorkspace, lp::SpaceParm{4,6,B,D}) where {B,D}
if abs(dpar.csw) > 1.0E-10 if abs(dpar.csw) > 1.0E-10
@timeit "g5Dw_new" begin @timeit "g5Dw_new" begin
CUDA.@sync begin CUDA.@sync begin
CUDA.@cuda threads=lp.bsz blocks=lp.rsz krnl_g5Dwimpr_new!(so, U, si, dws.csw, dpar.m0, dpar.th, dpar.csw, dpar.ct, lp) CUDA.@cuda threads=lp.bsz blocks=lp.rsz krnl_g5Dwimpr_new!(so, U, si, dws.csw, dpar.m0, dpar.th, dpar.csw, lp)
end end
end end
else else
...@@ -884,7 +883,7 @@ function pfrandomize!(f::AbstractArray{Spinor{4, SU3fund{T}}},lp::SpaceParm,t::I ...@@ -884,7 +883,7 @@ function pfrandomize!(f::AbstractArray{Spinor{4, SU3fund{T}}},lp::SpaceParm,t::I
@timeit "Randomize pseudofermion field" begin @timeit "Randomize pseudofermion field" begin
p = ntuple(i->CUDA.randn(T, lp.bsz, 3, lp.rsz,2),4) # complex generation not suported for Julia 1.5.4 p = ntuple(i->CUDA.randn(T, lp.bsz, 3, lp.rsz,2),4) # complex generation not suported for Julia 1.5.4
CUDA.@sync begin CUDA.@sync begin
CUDA.@cuda threads=lp.bsz blocks=lp.rsz krnl_assign_pf!(f,p,lp,t) CUDA.@cuda threads=lp.bsz blocks=lp.rsz krnl_assign_pf_su3!(f,p,lp,t)
end end
end end
...@@ -892,7 +891,7 @@ function pfrandomize!(f::AbstractArray{Spinor{4, SU3fund{T}}},lp::SpaceParm,t::I ...@@ -892,7 +891,7 @@ function pfrandomize!(f::AbstractArray{Spinor{4, SU3fund{T}}},lp::SpaceParm,t::I
end end
function krnl_assign_pf!(f::AbstractArray, p ,lp::SpaceParm, t::Int64) function krnl_assign_pf_su3!(f::AbstractArray, p ,lp::SpaceParm, t::Int64)
@inbounds begin @inbounds begin
b = Int64(CUDA.threadIdx().x) b = Int64(CUDA.threadIdx().x)
...@@ -914,6 +913,40 @@ function krnl_assign_pf!(f::AbstractArray, p ,lp::SpaceParm, t::Int64) ...@@ -914,6 +913,40 @@ function krnl_assign_pf!(f::AbstractArray, p ,lp::SpaceParm, t::Int64)
end end
function pfrandomize!(f::AbstractArray{Spinor{4, SU2fund{T}}},lp::SpaceParm,t::Int64=0) where {T}
@timeit "Randomize pseudofermion field" begin
p = ntuple(i->CUDA.randn(T, lp.bsz, 2, lp.rsz,2),4) # complex generation not suported for Julia 1.5.4
CUDA.@sync begin
CUDA.@cuda threads=lp.bsz blocks=lp.rsz krnl_assign_pf_su2!(f,p,lp,t)
end
end
return nothing
end
function krnl_assign_pf_su2!(f::AbstractArray, p ,lp::SpaceParm, t::Int64)
@inbounds begin
b = Int64(CUDA.threadIdx().x)
r = Int64(CUDA.blockIdx().x)
if t == 0
f[b,r] = Spinor(map(x->SU3fund(x[b,1,r,1] + im* x[b,1,r,2],
x[b,2,r,1] + im* x[b,2,r,2]),p))
elseif point_time((b,r),lp) == t
f[b,r] = Spinor(map(x->SU3fund(x[b,1,r,1] + im* x[b,1,r,2],
x[b,2,r,1] + im* x[b,2,r,2]),p))
end
end
return nothing
end
export Dw!, DwdagDw!, g5Dw!, pfrandomize!, Csw!, Dw_new!, g5Dw_new!, DwdagDw_new!, SF_bndfix! export Dw!, DwdagDw!, g5Dw!, pfrandomize!, Csw!, Dw_new!, g5Dw_new!, DwdagDw_new!, SF_bndfix!
......
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