Skip to content

Commit 1f8a4c9

Browse files
committed
tests for #41 (fixes are in Sugar + Transpiler)
1 parent 7102bd7 commit 1f8a4c9

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

test/broadcast.jl

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,44 @@ test(idx, A) = A[idx] * 2f0
6363
u0c = rand(Float32, 32, 32)
6464
u0 = GPUArray(u0c)
6565
@test Array(abs.(u0)) abs.(u0c)
66+
67+
#########
68+
# issue #41
69+
Ac = rand(Float32, 32, 32)
70+
uprev = GPUArray(Ac)
71+
k1 = GPUArray(Ac)
72+
k2 = GPUArray(Ac)
73+
k3 = GPUArray(Ac)
74+
k4 = GPUArray(Ac)
75+
dt = 1.2f0
76+
b1 = 1.3f0
77+
b2 = 1.4f0
78+
b3 = 1.5f0
79+
b4 = 1.6f0
80+
# The first issue is likely https://github.com/JuliaLang/julia/issues/22255
81+
# since GPUArrays adds some arguments to the function, it becomes longer longer, hitting the 12
82+
# so this wont fix for now
83+
#@. utilde = uprev + dt*(b1*k1 + b2*k2 + b3*k3 + b4*k4)
84+
85+
duprev = GPUArray(Ac)
86+
ku = GPUArray(Ac)
87+
u = similar(duprev)
88+
uc = similar(Ac)
89+
if backend == :cudanative
90+
# Not sure what's wrong with CUDAnative - since it works with OpenCL, it should all be clean
91+
# non erroring type stable code...
92+
#= CUDAnative error
93+
error compiling broadcast_kernel!: error compiling #5: error compiling Type:
94+
error compiling string: emit_builtin_call for strings/io.jl:120 requires the runtime language feature, which is disabled
95+
Looks like it tries to compile a call to error?
96+
=#
97+
fract = Float32(1//2)
98+
@. u = uprev + dt*duprev + dt^2*(fract*ku)
99+
else
100+
@. u = uprev + dt*duprev + dt^2*(1//2*ku)
101+
end
102+
@. uc = Ac + dt*Ac + dt^2*(1//2*Ac)
103+
@test Array(u) uc
66104
end
67105

68106
function testv3_1(a, b)

0 commit comments

Comments
 (0)