Are there any way to copy a Dict or a custom datatype which contains an Array to GPU by CUDA?

You didn’t mention wrapping that struct in an array as well. That’s currently not supported by CuArray. You can work around it by eagerly converting the CuArrays to CuDeviceArray (which are isbits) using cudaconvert and storing those in a CuArray, see e.g. Passing array of pointers to CUDA kernel. But to cudaconvert your TestType here you’ll need to make it parametric (a::T, b::T, T<:AbstractArray) and add Adapt.jl rules (Adapt.adapt_structure(to, x::TestType) = TestType(adapt(to, x,a), ...)), as I mentioned above.

3 Likes