我正在通过pycuda复制GPU上的一些数组,然后存储指向这些数组的指针。如何恢复数据?
dist = np.zeros(numPoints).astype(np.float32)
distAddress = [gpuarray.to_gpu(dist).ptr for i in range(100)]
如果我调用memcpy_dtoh函数:
buf = np.zeros(400).astype(np.float32)
cuda.memcpy_dtoh(buf,distAddress[0])
,(其中
type(distAddress[0])
是
long
)我得到以下错误:
cuda.memcpy_dtoh(buf, distAddress[0])
LogicError: cuMemcpyDtoH failed: invalid argument
我做错了什么?
谢谢