Skip to content

Commit 30a76f7

Browse files
committed
add back opencl
1 parent a7bfb86 commit 30a76f7

File tree

2 files changed

+16
-17
lines changed

2 files changed

+16
-17
lines changed

src/abstractarray.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -506,11 +506,12 @@ function Base.reshape(a::AbstractAccArray{T}, dims::NTuple{N,Int}) where T where
506506
end
507507

508508

509+
509510
function mapreducedim_kernel(state, f, op, R::AbstractArray{T1, N}, A::AbstractArray{T, N}, slice_size, sizeA, dim) where {T1, T, N}
510511
ilin = Cuint(linear_index(R, state))
511512
accum = zero(T1)
512513
@inbounds for i = Cuint(1):slice_size
513-
idx = ifelse.(ntuple(Cuint, Val{N}) .== dim, i, ilin)
514+
idx = N == dim ? (ilin, i) : (i, ilin)
514515
i2d = gpu_sub2ind(sizeA, idx)
515516
accum = op(accum, f(A[i2d]))
516517
end

test/shared.jl

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -156,20 +156,18 @@ end
156156

157157

158158
@allbackends "mapreduce" backend begin
159-
if backend != :opencl
160-
y = rand(Float32, 40, 40)
161-
x = GPUArray(y)
162-
@test sum(y, 2) Array(sum(x, 2))
163-
@test sum(y, 1) Array(sum(x, 1))
164-
165-
y = rand(Float32, 40, 10)
166-
x = GPUArray(y)
167-
@test sum(y, 2) Array(sum(x, 2))
168-
@test sum(y, 1) Array(sum(x, 1))
169-
170-
y = rand(Float32, 10, 40)
171-
x = GPUArray(y)
172-
@test sum(y, 2) Array(sum(x, 2))
173-
@test sum(y, 1) Array(sum(x, 1))
174-
end
159+
y = rand(Float32, 40, 40)
160+
x = GPUArray(y)
161+
@test sum(y, 2) Array(sum(x, 2))
162+
@test sum(y, 1) Array(sum(x, 1))
163+
164+
y = rand(Float32, 40, 10)
165+
x = GPUArray(y)
166+
@test sum(y, 2) Array(sum(x, 2))
167+
@test sum(y, 1) Array(sum(x, 1))
168+
169+
y = rand(Float32, 10, 40)
170+
x = GPUArray(y)
171+
@test sum(y, 2) Array(sum(x, 2))
172+
@test sum(y, 1) Array(sum(x, 1))
175173
end

0 commit comments

Comments
 (0)