CuArrays.jl errors with indexing / CartesianIndices


I need to record the range of a subarray in a struct in order to define a padded-array.

However I have troubles using indexing in CuArrays.jl. Basically, the only solution which works is to use things like u[1:10,1:10] .= v but if I want to consider different array dimensions, I have to rewrite the code.

Am I missing a point?

If somebody can give a hint, I would be gratefull,

Thank you,


using CuArrays
N = 100
u = CuArrays.CuArray(rand(N,N))
v = CuArrays.CuArray(rand(10,10))
u[1:10,1:10] ;#OK
u[1:10,1:10] .= v ;#OK

rang = CartesianIndices((1:10,1:10))
u[rang]; #error
u[rang] .= v ;#error

rang = LinearIndices((1:10,1:10))
u[rang]; #OK
u[rang] .= v ;#error

rang = (1:10,1:10)
u[rang[1],rang[2]].=v; #works but what if I want to consider 3d arrays?

It seems the solution is use

rang = (1:10,1:10)
u[rang...] .=v;