Are there any way to copy a Union Array to GPU with CUDA.jl?

Look at this example

abstract type AbstractTest end
struct ATest <: AbstractTest end
struct BTest <: AbstractTest end

struct CTest{T <: AbstractTest}
    a::T
end

using CUDA

CuArray([CTest(ATest()), CTest(BTest())])

Are there any method or trick to copy [CTest(ATest()), CTest(BTest())] to GPU with CUDA.jl?

No, Union arrays have complicated layout and are currently not supported.

1 Like