Closed
Description
julia> x = CUDA.zeros(10_000_000);
julia> y = ArrayPartition(x);
julia> y .= 0
ERROR: Scalar indexing is disallowed.
Invocation of setindex! resulted in scalar indexing of a GPU array.
This is typically caused by calling an iterating implementation of a method.
Such implementations *do not* execute on the GPU, but very slowly on the CPU,
and therefore should be avoided.
This should recursively apply a broadcast to the elements of the partition, which should then correctly dispatch to the GPU code. This doesn't work, so some CPU code is called instead.
Edit: It looks like a simple
function Base.fill!(m::ArrayPartition, x)
for i in eachindex(m.x)
fill!(m.x[i], x)
end
return m
end
might do the trick.