2012-11-19 30 views
4

是否有一种方法可以使用PyCuda将已经在GPU上的数组绑定到纹理?PyCuda中的cudaBindTextureToArray

已经有一个cuda.bind_array_to_texref(cuda.make_multichannel_2d_array(...), texref)结合了CPU到纹理上的一组,但是如果阵列已经在设备上我找不到的cudaBindTextureToArray在PyCuda相当。举例来说,这样做的:

myArray = [1, 2, 3] 
myArray_d = gpu.to_gpu(myArray) # then performs some computations on it, and then 
cuda.bind_texture_to_array(myArray_d, texref) 
+0

是不是'pycuda.driver.TextureReference.set_array()'你想要什么? – talonmies

+0

太好了,谢谢! :)(你可以添加,作为答案,我会验证) – WhitAngl

+0

传递给set_array的数组是GPU上的数组,对吧? – WhitAngl

回答

3

如果你想在GPU内存现有的CUDA数组绑定到纹理参考,然后pycuda.driver.TextureReference.set_array()可能是你想要的东西。请注意,PyCUDA建立在驱动程序API上,因此您要查找的电话实际上是cuTexRefSetArray而不是cudaBindTextureToArray