sfcf slightly modified

parent 3bd8f080
...@@ -64,6 +64,6 @@ include("Solvers/Solvers.jl") ...@@ -64,6 +64,6 @@ include("Solvers/Solvers.jl")
using .Solvers using .Solvers
export CG! export CG!
export propagator, bndpropagator export propagator, bndpropagator
export fP!, fA!, kV!, lV! export fP, fA, kV, lV
end # module end # module
...@@ -26,7 +26,7 @@ include("Propagators.jl") ...@@ -26,7 +26,7 @@ include("Propagators.jl")
export propagator, bndpropagator export propagator, bndpropagator
include("sfcf.jl") include("sfcf.jl")
export fP!, fA!, kV!, lV! export fP, fA, kV, lV
end end
function fP!(fp, dws::DiracWorkspace, prop::AbstractArray,lp::SpaceParm) function fP(prop::AbstractArray,dws::DiracWorkspace, lp::SpaceParm)
function krnl_fP!(sum,pro) function krnl_fP!(sum,pro)
b=Int64(CUDA.threadIdx().x) b=Int64(CUDA.threadIdx().x)
...@@ -16,12 +16,10 @@ function fP!(fp, dws::DiracWorkspace, prop::AbstractArray,lp::SpaceParm) ...@@ -16,12 +16,10 @@ function fP!(fp, dws::DiracWorkspace, prop::AbstractArray,lp::SpaceParm)
CUDA.@cuda threads=lp.bsz blocks=lp.rsz krnl_fP!(dws.cs,prop) CUDA.@cuda threads=lp.bsz blocks=lp.rsz krnl_fP!(dws.cs,prop)
end end
fp += reshape(Array(CUDA.reduce(+, dws.cs; dims=(1,2,3))),lp.iL[end]) return reshape(Array(CUDA.reduce(+, dws.cs; dims=(1,2,3))),lp.iL[end])
return nothing
end end
function fA!(fa, dws::DiracWorkspace, prop::AbstractArray,lp::SpaceParm) function fA(prop::AbstractArray,dws::DiracWorkspace, lp::SpaceParm)
function krnl_fA!(sum,pro) function krnl_fA!(sum,pro)
b=Int64(CUDA.threadIdx().x) b=Int64(CUDA.threadIdx().x)
...@@ -35,11 +33,11 @@ function fA!(fa, dws::DiracWorkspace, prop::AbstractArray,lp::SpaceParm) ...@@ -35,11 +33,11 @@ function fA!(fa, dws::DiracWorkspace, prop::AbstractArray,lp::SpaceParm)
CUDA.@sync begin CUDA.@sync begin
CUDA.@cuda threads=lp.bsz blocks=lp.rsz krnl_fA!(dws.cs,prop) CUDA.@cuda threads=lp.bsz blocks=lp.rsz krnl_fA!(dws.cs,prop)
end end
fa += reshape(Array(CUDA.reduce(+, dws.cs; dims=(1,2,3))),lp.iL[end])
return nothing return reshape(Array(CUDA.reduce(+, dws.cs; dims=(1,2,3))),lp.iL[end])
end end
function kV!(kv, dws::DiracWorkspace, prop::AbstractArray,lp::SpaceParm) function kV(prop::AbstractArray,dws::DiracWorkspace, lp::SpaceParm)
function krnl_kV!(sum,pro) function krnl_kV!(sum,pro)
b=Int64(CUDA.threadIdx().x) b=Int64(CUDA.threadIdx().x)
...@@ -53,11 +51,11 @@ function kV!(kv, dws::DiracWorkspace, prop::AbstractArray,lp::SpaceParm) ...@@ -53,11 +51,11 @@ function kV!(kv, dws::DiracWorkspace, prop::AbstractArray,lp::SpaceParm)
CUDA.@sync begin CUDA.@sync begin
CUDA.@cuda threads=lp.bsz blocks=lp.rsz krnl_kV!(dws.cs,prop) CUDA.@cuda threads=lp.bsz blocks=lp.rsz krnl_kV!(dws.cs,prop)
end end
kv += reshape(Array(CUDA.reduce(+, dws.cs; dims=(1,2,3))),lp.iL[end])
return nothing return reshape(Array(CUDA.reduce(+, dws.cs; dims=(1,2,3))),lp.iL[end])
end end
function lV!(lv, dws::DiracWorkspace, prop::AbstractArray,lp::SpaceParm) function lV(prop::AbstractArray,dws::DiracWorkspace, lp::SpaceParm)
function krnl_lV!(sum,pro) function krnl_lV!(sum,pro)
b=Int64(CUDA.threadIdx().x) b=Int64(CUDA.threadIdx().x)
...@@ -73,6 +71,6 @@ function lV!(lv, dws::DiracWorkspace, prop::AbstractArray,lp::SpaceParm) ...@@ -73,6 +71,6 @@ function lV!(lv, dws::DiracWorkspace, prop::AbstractArray,lp::SpaceParm)
CUDA.@sync begin CUDA.@sync begin
CUDA.@cuda threads=lp.bsz blocks=lp.rsz krnl_lV!(dws.cs,prop) CUDA.@cuda threads=lp.bsz blocks=lp.rsz krnl_lV!(dws.cs,prop)
end end
lv += reshape(Array(CUDA.reduce(+, dws.cs; dims=(1,2,3))),lp.iL[end])
return nothing return reshape(Array(CUDA.reduce(+, dws.cs; dims=(1,2,3))),lp.iL[end])
end end
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