Skip to content

Commit 1a496a6

Browse files
committed
tests/stencil: Switch Float64 to Float32 for GPUs
1 parent 2018d45 commit 1a496a6

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

test/array/stencil.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -110,14 +110,14 @@ function test_stencil()
110110
# slope at high boundary = 8.0 - 6.0 = 2.0
111111
# idx=0 → 2.0 + 2.0*(-1) = 0.0
112112
# idx=5 → 8.0 + 2.0*(1) = 10.0
113-
A = DArray([2.0, 4.0, 6.0, 8.0], Blocks(2))
114-
B = zeros(Blocks(2), Float64, 4)
113+
A = DArray([2f0, 4f0, 6f0, 8f0], Blocks(2))
114+
B = zeros(Blocks(2), Float32, 4)
115115
@stencil B[idx] = sum(@neighbors(A[idx], 1, LinearExtrapolate()))
116116
# B[1]: neighbors at indices 0, 1, 2 -> extrapolated 0 becomes 0.0, so [0.0, 2.0, 4.0] = 6.0
117117
# B[2]: neighbors at indices 1, 2, 3 -> [2.0, 4.0, 6.0] = 12.0
118118
# B[3]: neighbors at indices 2, 3, 4 -> [4.0, 6.0, 8.0] = 18.0
119119
# B[4]: neighbors at indices 3, 4, 5 -> extrapolated 5 becomes 10.0, so [6.0, 8.0, 10.0] = 24.0
120-
expected_B_extrap = [6.0, 12.0, 18.0, 24.0]
120+
expected_B_extrap = [6f0, 12f0, 18f0, 24f0]
121121
@test collect(B) expected_B_extrap
122122
end
123123

@@ -348,9 +348,9 @@ function test_stencil()
348348
@stencil B[idx] *= 3
349349
@test all(collect(B) .== 3)
350350

351-
C = DArray(fill(10.0, 4, 4), Blocks(2, 2))
352-
@stencil C[idx] /= 2.0
353-
@test all(collect(C) .== 5.0)
351+
C = DArray(fill(10f0, 4, 4), Blocks(2, 2))
352+
@stencil C[idx] /= 2f0
353+
@test all(collect(C) .== 5f0)
354354

355355
D = DArray(fill(10, 4, 4), Blocks(2, 2))
356356
@stencil D[idx] -= 1

0 commit comments

Comments
 (0)