I have a sequence of kernels. The 1st kernel receives 3D Texture and writes output to the linear memory.
In the 2nd kernel, which is launched after the first one has done its job, I want to access the output of the 1st one as a texture and write results to the linear memory, which is indeed the memory of the texture used in the 1st kernel and so on.
Of course, I would like to avoid unnecessary memory copying. So the question is very simple. Am I able to bind linear memory to 3D texture, so it could be used as read-only texture in one kernel and as linear memory for output purposes in another kernel?
Linear memory works for 1D textures
Pitch linear memory can be used for 2D textures
…and I don’t think there is a linear memory equivalent for 3D textures. cudaArrays are required.
It might be possible to use 2D layered textures also, but then you have to run your own bilinear interpolation code between layers.
the CUDA surfaces API allows writing to a 3D surface in one kernel, followed by read access in another.
an example is given in this stack overflow thread
https://stackoverflow.com/questions/38701467/3d-array-writing-and-reading-as-texture-in-cuda