Skip to content

Commit a7ddf98

Browse files
Merge pull request #1850 from CliMA/ck/cuda_stencil_tstability
Fix type instability in `copyto_stencil_kernel!`
2 parents f36251c + 6200989 commit a7ddf98

File tree

1 file changed

+12
-15
lines changed

1 file changed

+12
-15
lines changed

ext/cuda/operators_finite_difference.jl

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -55,21 +55,18 @@ function copyto_stencil_kernel!(out, bc, space, bds, us)
5555
(v, i, j, h) = cart_ind((Nv, Nq, Nq, Nh), gid).I
5656
hidx = (i, j, h)
5757
idx = v - 1 + li
58-
window =
59-
idx < lw ?
60-
LeftBoundaryWindow{Spaces.left_boundary_name(space)}() :
61-
(
62-
idx > rw ?
63-
RightBoundaryWindow{Spaces.right_boundary_name(space)}() :
64-
Interior()
65-
)
66-
setidx!(
67-
space,
68-
out,
69-
idx,
70-
hidx,
71-
Operators.getidx(space, bc, window, idx, hidx),
72-
)
58+
if idx < lw
59+
lwindow = LeftBoundaryWindow{Spaces.left_boundary_name(space)}()
60+
val = Operators.getidx(space, bc, lwindow, idx, hidx)
61+
elseif idx > rw
62+
rwindow =
63+
RightBoundaryWindow{Spaces.right_boundary_name(space)}()
64+
val = Operators.getidx(space, bc, rwindow, idx, hidx)
65+
else
66+
iwindow = Interior()
67+
val = Operators.getidx(space, bc, iwindow, idx, hidx)
68+
end
69+
setidx!(space, out, idx, hidx, val)
7370
end
7471
end
7572
return nothing

0 commit comments

Comments
 (0)