Copyto! does not work for subarray when scalar get index is disallowed?

I have a large Array in CPU and want to copy back the GPU data to it. Here is a demo:

using CuArrays
CuArrays.allowscalar(false)
N = 100
u_c = rand(N, 2);
u_d = CuArrays.CuArray(ones(N));
u_v = view(u_c, :, 1);
copyto!(u_d, u_v) #works
println(Array(u_d)-u_c[:, 1])
copyto!(u_v, u_d) #does not works

Any help?

That should probably work, please file an issue.
As a workaround, you can do @allowscalar copyto!(...) to temporarily allow scalar indexing.

2 Likes