使用CUDAnative报错:KernelError: passing and using non-bitstype argument

通过CuArrays.jl的 tutorials学习julia GPU运算时,运行tutorial上的例子报错,代码如下:

using CuArrays
x_d = CuArrays.fill(1.0f0, N)  # a vector stored on the GPU filled with 1.0 (Float32)
y_d = CuArrays.fill(2.0f0, N)  # a vector stored on the GPU filled with 2.0
using CUDAnative
function gpu_add1!(y, x)
    for i = 1:length(y)
        @inbounds y[i] += x[i]
    end
    return nothing
end

fill!(y_d, 2)
@cuda gpu_add1!(y_d, x_d)

运行完@cuda gpu_add1!(y_d, x_d)报错信息为:

ERROR: GPU compilation of gpu_add1!(Array{Float32,1}, Array{Float32,1}) failed
KernelError: passing and using non-bitstype argument

Argument 2 to your kernel function is of type Array{Float32,1}.
That type is not isbits, and such arguments are only allowed when they are unused by the kernel.

删掉@cuda不会报错,Julia版本为1.1.1,库版本分别为CUDAnative v2.0.1和CuArrays v1.0.1,CUDA版本为10.1,在Ubuntu18.04下和win10下运行都会有这种报错。
谢谢好心人!

我印象中 Cuarrays.fill 有点问题,但是不确定master上是不是已经修复了,你可以试下,还有问题的话可以去提个PR