Skip to content

Commit 7c20a0e

Browse files
committed
Fixup tests
1 parent 2f798bf commit 7c20a0e

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

test/runtests.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,11 @@ global prefer_threads::Bool = !(IS_CPU_BACKEND && "--cpuKA" in ARGS)
5959

6060
array_from_host(h_arr::AbstractArray, dtype=nothing) = array_from_host(BACKEND, h_arr, dtype)
6161
function array_from_host(backend, h_arr::AbstractArray, dtype=nothing)
62-
d_arr = KernelAbstractions.zeros(backend, isnothing(dtype) ? eltype(h_arr) : dtype, size(h_arr))
62+
d_arr = if IS_CPU_BACKEND && prefer_threads # Don't use KA zeros if not using KA algorithms
63+
zeros(isnothing(dtype) ? eltype(h_arr) : dtype, size(h_arr))
64+
else
65+
KernelAbstractions.zeros(backend, isnothing(dtype) ? eltype(h_arr) : dtype, size(h_arr))
66+
end
6367
copyto!(d_arr, h_arr isa Array ? h_arr : Array(h_arr)) # Allow unmaterialised types, e.g. ranges
6468
d_arr
6569
end

0 commit comments

Comments
 (0)