I wanted to ask for some advice regarding textures and cudaArrays. Currently I have a class “Crowd” defined in a C++ file “Crowd.cpp” with all of its methods and variables etc. I have a separate “CrowdSim.cu” file containing wrappers for methods such as cudaMalloc so that I can call them from methods in my “Crowd” class. I have also planned on using this “CrowdSim.cu” file to allow me to call kernels in “crowd_kernels.cu” from each crowd object e.g. as part of a crowd update method.
I want to be able to have the positions of several crowds stored in their own cudaArrays so that I can bind these one at a time to a texture in order to take advantage of cudaFilterModeLinear for linear interpolation when reading from the texture. These textures would be read from during execution of a “posUpdate” kernel.
I can’t add a cudaArray variable to each crowd object in “Crowd.cpp”. As such I am trying to find some way to create cudaArrays in my “CrowdSim.cu” or “crowd_kernels.cu” file so that an array gets made every time I create a new crowd object. These arrays could then can be subsequently accessed in order to update data in the array and to bind each array to the texture and do “updatePos” in turn. I could create a new array every time I run the update on each crowd but this seems wasteful.
Any help would be greatly appreciated.