I am developing a system that make computations in two steps (both executed in the GPU): the first step is solved with CUDA and the second one is solved with GLSL.
In each step the programs (CUDA and GLSL) will have to read ~100 float elements from the same READ-ONLY data array.
The total size of this array spans over hundreds of KB.
The question is: How can I store this data array into the GPU memory in order to make it available for reading for both CUDA and GLSL programs???
- If I store this entire array in a VBO, I can read it with CUDA, but I cannot with GLSL.
- If I store this entire array in the GPU global memory (with cudaMalloc() and cudaMemcpy() ), I can access this data from CUDA, but not from GLSL… again.
- If I store this data in a texture, I SUPPOSE I can access it from CUDA and also from GLSL… BUT texture fetches are slower then simple array or VBO reading.
—> This (number 4) seems promising…
- I read about the Bindable Uniform Buffer Objects, and they seemed perfect. I know that these buffers can be read by GLSL as ordinary const arrays (good, fast!), and I SUPPOSE that they can be read by CUDA since they are buffers (like VBOs)… however, this buffers have a upper limit… in my current system (GeForce 8400) they can have at most 64KB… and I suppose that it is not so different for the 8600, 8800… and so on. I suppose that this limit in size is due the fact that these buffers are created in the constant GPU memory. Am I correct? My system allows for up to 12 buffers like this, but this does not solve my problem… I needed a contiguous chunk of memory (it is easier ans faster to index and access).
So… some questions regarding these Bindable Uniform Buffer Objects…:
Question 1) They are in fact limited in size? Question 2) Supposing that these buffers are in fact limited to 64KB: Can I (first) create such a buffer, (second) upload all my array data to the GPU global memory (with cudaMalloc() and cudaMemcpy() ), and (third) copy small portions of the data located in the global memory over these buffer memory footprints?? The problem with my Question 2 is that those Bindable Uniform Buffers are created with OpenGL calls, and I just get an integer ID for the buffer (and not a pointer for the GPU allocated mem.). Is there a way to find these pointers from those buffer IDs generated by OpenGL ??? Any other solution better then those above mentioned???? :) Ok, that's all for a while folks... Any help is welcome!!!! [ ]s Capagot