In a thread of a kernel I want to create a matrix (one matrix by thread) and then read it. Can I do the following in this sequence?
1st Populate the matrix
2nd Create a texture to the matrix in the device
3rd Read the Matrix
You can suggest another procedure
You cannot create a texture in device code.
A texture is by definition not writable from device code.
A surface is something like a texture, and it is writable from device code. Whether or not this makes sense in the context of a matrix per thread, I don’t know.
There are various CUDA sample codes that demonstrate use of surfaces. However the surface still has to be set up (including allocation, binding, etc.) from host code, before you can use it in device code.