diff --git a/src/Fields/Fields.jl b/src/Fields/Fields.jl new file mode 100644 index 0000000..ae665f3 --- /dev/null +++ b/src/Fields/Fields.jl @@ -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. +### +### 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) diff --git a/src/LatticeGPU.jl b/src/LatticeGPU.jl index 5ca9987..af2aa78 100644 --- a/src/LatticeGPU.jl +++ b/src/LatticeGPU.jl @@ -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") diff --git a/src/YM/YM.jl b/src/YM/YM.jl index dcc4aee..ebdf41d 100644 --- a/src/YM/YM.jl +++ b/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 diff --git a/src/YM/YMfields.jl b/src/YM/YMfields.jl index 3797766..a0ea8b5 100644 --- a/src/YM/YMfields.jl +++ b/src/YM/YMfields.jl @@ -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 diff --git a/src/main/test.jl b/src/main/test.jl index 9ac1b9f..6d0d1c6 100644 --- a/src/main/test.jl +++ b/src/main/test.jl @@ -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: ") diff --git a/src/main/times.jl b/src/main/times.jl index 757ea29..c40afad 100644 --- a/src/main/times.jl +++ b/src/main/times.jl @@ -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: ")