From 9afed984e13bb1efd6e9568a5ceda6a4ef38b31d Mon Sep 17 00:00:00 2001 From: OsKnoth <50015520+OsKnoth@users.noreply.github.com> Date: Mon, 11 Dec 2023 23:00:25 +0100 Subject: [PATCH] Update testAMD.jl --- Examples/testAMD.jl | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Examples/testAMD.jl b/Examples/testAMD.jl index 21542b3..30cd5c1 100644 --- a/Examples/testAMD.jl +++ b/Examples/testAMD.jl @@ -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 @@ -34,7 +34,7 @@ using KernelAbstractions.Extras end end -backend = CPU() +backend = CUDABackend() FT = Float32 M = 100 N = 101 @@ -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