mirror of
https://igit.ific.uv.es/alramos/latticegpu.jl.git
synced 2025-05-14 19:23:42 +02:00
Generic interface to create fields
This commit is contained in:
parent
3f71a5222f
commit
0fe33c5b38
6 changed files with 30 additions and 24 deletions
15
src/Fields/Fields.jl
Normal file
15
src/Fields/Fields.jl
Normal file
|
@ -0,0 +1,15 @@
|
|||
###
|
||||
### "THE BEER-WARE LICENSE":
|
||||
### Alberto Ramos wrote this file. As long as you retain this
|
||||
### notice you can do whatever you want with this stuff. If we meet some
|
||||
### day, and you think this stuff is worth it, you can buy me a beer in
|
||||
### return. <alberto.ramos@cern.ch>
|
||||
###
|
||||
### file: Fields.jl
|
||||
### created: Wed Oct 6 17:37:03 2021
|
||||
###
|
||||
|
||||
|
||||
vector_field(::Type{T}, lp::SpaceParm) where {T} = CuArray{T, 3}(undef, lp.bsz, lp.ndim, lp.rsz)
|
||||
scalar_field(::Type{T}, lp::SpaceParm) where {T} = CuArray{T, 3}(undef, lp.bsz, lp.rsz)
|
||||
nscalar_field(::Type{T}, n, lp::SpaceParm) where {T} = CuArray{T, 3}(undef, lp.bsz, n, lp.rsz)
|
|
@ -25,6 +25,9 @@ using .Space
|
|||
export SpaceParm
|
||||
export up, dw, updw, global_point
|
||||
|
||||
include("Fields/Fields.kl")
|
||||
export vector_field, scalar_field, nscalar_field
|
||||
|
||||
|
||||
include("YM/YM.jl")
|
||||
|
||||
|
|
20
src/YM/YM.jl
20
src/YM/YM.jl
|
@ -49,22 +49,22 @@ struct YMworkspace{T}
|
|||
if (G == SU2)
|
||||
GRP = SU2
|
||||
ALG = SU2alg
|
||||
f1 = field(SU2alg{T}, lp)
|
||||
f2 = field(SU2alg{T}, lp)
|
||||
mm = field(SU2alg{T}, lp)
|
||||
u1 = field(SU2{T}, lp)
|
||||
f1 = vector_field(SU2alg{T}, lp)
|
||||
f2 = vector_field(SU2alg{T}, lp)
|
||||
mm = vector_field(SU2alg{T}, lp)
|
||||
u1 = vector_field(SU2{T}, lp)
|
||||
end
|
||||
|
||||
if (G == SU3)
|
||||
GRP = SU3
|
||||
ALG = SU3alg
|
||||
f1 = field(SU3alg{T}, lp)
|
||||
f2 = field(SU3alg{T}, lp)
|
||||
mm = field(SU3alg{T}, lp)
|
||||
u1 = field(SU3{T}, lp)
|
||||
f1 = vector_field(SU3alg{T}, lp)
|
||||
f2 = vector_field(SU3alg{T}, lp)
|
||||
mm = vector_field(SU3alg{T}, lp)
|
||||
u1 = vector_field(SU3{T}, lp)
|
||||
end
|
||||
cs = CuArray{Complex{T}, 2}(undef, lp.bsz,lp.rsz)
|
||||
rs = CuArray{T, 2}(undef, lp.bsz,lp.rsz)
|
||||
cs = scalar_field(Complex{T}, lp)
|
||||
rs = scalar_field(T, lp)
|
||||
|
||||
return new{T}(GRP,ALG,T,f1, f2, mm, u1, cs, rs)
|
||||
end
|
||||
|
|
|
@ -9,18 +9,6 @@
|
|||
### created: Thu Jul 15 15:16:47 2021
|
||||
###
|
||||
|
||||
function field(::Type{T}, lp::SpaceParm) where {T}
|
||||
|
||||
sz = lp.bsz, lp.ndim, lp.rsz
|
||||
return CuArray{T, 3}(undef, sz)
|
||||
end
|
||||
|
||||
function field_pln(::Type{T}, lp::SpaceParm) where {T}
|
||||
|
||||
sz = lp.bsz, lp.npls, lp.rsz, 3
|
||||
return CuArray{T, 4}(undef, sz)
|
||||
end
|
||||
|
||||
function randomize!(f, lp::SpaceParm, ymws::YMworkspace)
|
||||
|
||||
if ymws.ALG == SU2alg
|
||||
|
|
|
@ -25,7 +25,7 @@ Random.seed!(1234)
|
|||
println("Precision: ", PREC)
|
||||
|
||||
println("Allocating gauge field")
|
||||
U = field(GRP{PREC}, lp)
|
||||
U = vector_field(GRP{PREC}, lp)
|
||||
fill!(U, one(GRP{PREC}))
|
||||
|
||||
println("Take to take the configuration to memory: ")
|
||||
|
|
|
@ -26,7 +26,7 @@ ymws = YMworkspace(GRP, PREC, lp)
|
|||
|
||||
# Main program
|
||||
println("Allocating gauge field")
|
||||
U = field(GRP{PREC}, lp)
|
||||
U = vector_field(GRP{PREC}, lp)
|
||||
fill!(U, one(GRP{PREC}))
|
||||
|
||||
println("Time to take the configuration to memory: ")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue