NumaPro Cuda 设备函数 - Return 多个数组和本地内存

NumaPro Cuda Device Function - Return multiple Arrays and local memory

如果您想编写 return 多个数组的设备函数,有人知道 cuda.jit 装饰器的正确语法是什么吗?

如果我的设备函数应该 return 一个浮点数并且有两个整数参数,我的装饰器将是:

@cuda.jit('float64(int64,int64)', device=True, inline=True)

现在我希望我的函数采用两个整数参数和两个浮点数以及 return 2 个浮点数数组和 2 个整数数组,它们的长度都相同(在 3 到 5 之间),具体取决于输入争论。我怎么做? 是否正确:

@cuda.jit(restype=[float64[:], int64[:], float64[:], int64[:]], argtypes=[int64, int64, float64, float64], device=True, inline = True)

同样在我的函数中,我将创建我想要 return 的数组,方法是使用:cuda.local.array() 因为我使用 inline=True 我怀疑这会起作用并且数组只能由相应的线程访问,对吧?

Now I want my function to take two integer parameters and two floats and return 2 arrays of floats and 2 arrays of integers

您真正想说的是您希望 JIT 内核 return 一个元组(两个数组)。不幸的是,在 nopython 前端,我认为这是不合法的。 nopython 中没有对象支持,所以你不能实例化和 return 元组对象。

Also in my function I would create the arrays I want to return by using: cuda.local.array()

不幸的是,这也不支持。只有 return 作为参数传递给函数的数组才是合法的。