CudaBindTextureToArray in PyCuda

Is there a way to bind an array that is already on gpu to a texture using PyCuda?

There is already cuda.bind_array_to_texref(cuda.make_multichannel_2d_array(...), texref) that binds the array to the processor to the texture, but I could not find the equivalent of cudaBindTextureToArray in PyCuda if the array is already on the device. For example, by doing:

 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) 
+4
source share
1 answer

If you want to associate an existing CUDA array in GPU memory with a texture reference, then pycuda.driver.TextureReference.set_array() is probably what you want. Note that PyCUDA is built on the driver API, so the call you are looking for is actually cuTexRefSetArray , not cudaBindTextureToArray .

+3
source

Source: https://habr.com/ru/post/1447070/


All Articles