Skip to content

Commit

Permalink
Cleanup script (#21)
Browse files Browse the repository at this point in the history
Cleanup unused args in scripts/l8_diffusion_2D_perf_xpu.jl
  • Loading branch information
luraess authored Nov 13, 2024
2 parents 628d5f0 + c44a8de commit de1611a
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions scripts/l8_scripts/l8_diffusion_2D_perf_xpu.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ using Plots, Printf
macro qx(ix, iy) esc(:(-D_dx * (C[$ix+1, $iy+1] - C[$ix, $iy+1]))) end
macro qy(ix, iy) esc(:(-D_dy * (C[$ix+1, $iy+1] - C[$ix+1, $iy]))) end

@parallel_indices (ix, iy) function compute!(C2, C, D_dx, D_dy, dt, _dx, _dy, size_C1_2, size_C2_2)
@parallel_indices (ix, iy) function compute!(C2, C, D_dx, D_dy, dt, size_C1_2, size_C2_2)
if (ix <= size_C1_2 && iy <= size_C2_2)
C2[ix+1, iy+1] = C[ix+1, iy+1] - dt * ((@qx(ix + 1, iy) - @qx(ix, iy)) * _dx + (@qy(ix, iy + 1) - @qy(ix, iy)) * _dy)
C2[ix+1, iy+1] = C[ix+1, iy+1] - dt * ((@qx(ix + 1, iy) - @qx(ix, iy)) * D_dx + (@qy(ix, iy + 1) - @qy(ix, iy)) * D_dy)
end
return
end
Expand All @@ -35,7 +35,6 @@ end
xc, yc = LinRange(dx / 2, Lx - dx / 2, nx), LinRange(dy / 2, Ly - dy / 2, ny)
D_dx = D / dx
D_dy = D / dy
_dx, _dy = 1.0 / dx, 1.0 / dy
# Array initialisation
C = Data.Array(exp.(.-(xc .- Lx / 2) .^ 2 .- (yc' .- Ly / 2) .^ 2))
C2 = copy(C)
Expand All @@ -49,7 +48,7 @@ end
# Time loop
for it = 1:nt
if (it == 11) t_tic = Base.time(); niter = 0 end
@parallel compute!(C2, C, D_dx, D_dy, dt, _dx, _dy, size_C1_2, size_C2_2)
@parallel compute!(C2, C, D_dx, D_dy, dt, size_C1_2, size_C2_2)
C, C2 = C2, C # pointer swap
niter += 1
if do_visu && (it % nout == 0)
Expand Down

0 comments on commit de1611a

Please sign in to comment.