Arrays of arrays and arrays of structures in CUDA kernels cause random errors

I also tried the following:

cuintegs = CuArray([cudaconvert(integs[i]) for i=1:Np])

GC.@preserve integs begin
    @cuda threads=nthreads blocks=nblocks kernel(u, cuintegs)
end

Unfortunately, it does not help.

As far as I understand, when the function cudaconvert(integs[i]) is called it also calls the corresponding adaptor:

function Adapt.adapt_structure(to, integ::Integrator)
    ks = [Adapt.adapt(to, integ.ks[i]) for i=1:length(integ.ks)]
    ks = CuArray(ks)
    ks = Adapt.adapt_structure(to, ks)
    return Integrator(integ.p, ks)
end

Inside this adaptor I do the same trick with the ks array of CuArrays which is the field of each integs[i] structure. According to your explanation, here I have the same issue when I transform integ.ks to CuArray ks. However, here it is not clear how to preserve integ.ks.