Skip to content

Commit

Permalink
Update testAMD.jl
Browse files Browse the repository at this point in the history
  • Loading branch information
OsKnoth committed Dec 11, 2023
1 parent 5b732a2 commit 9afed98
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions Examples/testAMD.jl
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ using KernelAbstractions.Extras
L = @uniform @ndrange()[3]

if 1 < i && i < M && j > 1 && j < N && k > 1 && k < L
@inbounds FluxW = FT(0.5) * (u[i-1,j,k] - abs(u[i-1,j,k])) * c[i,j,k]
@inbounds FluxE = FT(0.5) * (u[i,j,k] + abs(u[i,j,k])) * c[i,j,k]
@inbounds FluxS = FT(0.5) * (v[i,j-1,k] - abs(v[i,j-1,k])) * c[i,j,k]
@inbounds FluxN = FT(0.5) * (v[i,j,k] + abs(v[i,j,k])) * c[i,j,k]
@inbounds FluxB = FT(0.5) * (w[i,j,k-1] - abs(w[i,j,k-1])) * c[i,j,k]
@inbounds FluxT = FT(0.5) * (w[i,j,k] + abs(w[i,j,k])) * c[i,j,k]
@inbounds FluxW = eltype(Flux)(0.5) * (u[i-1,j,k] - abs(u[i-1,j,k])) * c[i,j,k]
@inbounds FluxE = eltype(Flux)(0.5) * (u[i,j,k] + abs(u[i,j,k])) * c[i,j,k]
@inbounds FluxS = eltype(Flux)(0.5) * (v[i,j-1,k] - abs(v[i,j-1,k])) * c[i,j,k]
@inbounds FluxN = eltype(Flux)(0.5) * (v[i,j,k] + abs(v[i,j,k])) * c[i,j,k]
@inbounds FluxB = eltype(Flux)(0.5) * (w[i,j,k-1] - abs(w[i,j,k-1])) * c[i,j,k]
@inbounds FluxT = eltype(Flux)(0.5) * (w[i,j,k] + abs(w[i,j,k])) * c[i,j,k]
@inbounds @atomic Flux[i-1,j,k] += -FluxW
@inbounds @atomic Flux[i+1,j,k] += FluxE
@inbounds @atomic Flux[i,j-1,k] += -FluxS
Expand All @@ -34,7 +34,7 @@ using KernelAbstractions.Extras
end
end

backend = CPU()
backend = CUDABackend()
FT = Float32
M = 100
N = 101
Expand All @@ -51,7 +51,7 @@ Flux = KernelAbstractions.zeros(backend,FT,M,N,L)

KFluxUpdateKernel! = FluxUpdateKernel!(backend,group)

KFluxUpdateKernel!(Flux,u,v,w,c,ndrange=ndrange)
KFluxUpdateKernel!(Flux,u,v,w,c,ndrange=ndrange)
@time for iter = 1 : 100
KFluxUpdateKernel!(Flux,u,v,w,c,ndrange=ndrange)
end

0 comments on commit 9afed98

Please sign in to comment.