I’m a bit unclear on how things work with textures wrt multiple kernel invocations. My use case is that I have three arrays to process by the same kernel. I want to use a 2d texture for the arrays. My understanding (I am new so may be wrong) is that it’s not possible to pass texture reference as a parameter to the kernel so the kernel is hard coded to use a single texture. Also that kernel invocations are asynchronous. So will there be any problem calling the kernel that refer a single hard coded texture multiple times?
for i = 1 to n:
allocate pitched device memory for array i
copy array i host memory to device
for i = 1 to n:
bind array i to texture
call kernel
unbind texture
for i = 1 to n:
free array i device memory
Do I have to put a blocking synchronization call in 2nd the loop? What if I wanted to use cuda streams? Is there any problem to worry about?