mirror of
https://igit.ific.uv.es/alramos/latticegpu.jl.git
synced 2025-05-15 03:33:42 +02:00
Implemented cross term dot(phi1, phi2)
This commit is contained in:
parent
369f3f2d42
commit
2e8e76e11c
6 changed files with 115 additions and 16 deletions
|
@ -62,4 +62,47 @@ function krnl_act!(act, U::AbstractArray{TG}, Phi::AbstractArray{TS}, sp::Scalar
|
|||
|
||||
return nothing
|
||||
end
|
||||
|
||||
function krnl_act!(act, U::AbstractArray{TG}, Phi::AbstractArray{TS}, sp::ScalarParm{2,T}, lp::SpaceParm{N,M,D}) where {TG,TS,T,N,M,D}
|
||||
|
||||
|
||||
b, r = CUDA.threadIdx().x, CUDA.blockIdx().x
|
||||
|
||||
Ush = @cuStaticSharedMem(TG, (D,N))
|
||||
Psh = @cuStaticSharedMem(TS, (D,2))
|
||||
|
||||
for id in 1:N
|
||||
Ush[b,id] = U[b,id,r]
|
||||
end
|
||||
for i in 1:2
|
||||
Psh[b,i] = Phi[b,i,r]
|
||||
end
|
||||
sync_threads()
|
||||
|
||||
S = zero(eltype(act))
|
||||
for id in 1:N
|
||||
bu, ru = up((b, r), id, lp)
|
||||
|
||||
for i in 1:2
|
||||
if ru == r
|
||||
Pup = Psh[bu,i]
|
||||
else
|
||||
Pup = Phi[bu,i,ru]
|
||||
end
|
||||
|
||||
S += -2*sp.kap[i]*dot(Psh[b,i],Ush[b,id]*Pup)
|
||||
end
|
||||
end
|
||||
|
||||
for i in 1:2
|
||||
sdot = dot(Psh[b,i],Psh[b,i])
|
||||
S += sdot + sp.eta[i]*(sdot - 1)^2
|
||||
end
|
||||
S += 2*sp.muh*dot(Psh[b,1], Psh[b,2])
|
||||
|
||||
I = point_coord((b,r), lp)
|
||||
act[I] = S
|
||||
|
||||
return nothing
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue