PDA

View Full Version : OpenCL - local memory over multiple kernels



Soxda2
07-19-2011, 07:13 AM
Hi Guys!

Is it possible, to generate some kind of data on GPU, store it in the local memory and use this data in more than one kernel?

It would be nice to see a simple example, if it's possible.

Thank you!

Maxim Milakov
07-19-2011, 08:52 AM
Is there anything preventing you from using global buffers? They keep their data between kernel runs.

Soxda2
07-19-2011, 09:12 AM
I've read that using local memory is much faster than using global memory. At the moment i use global memory. But the point is, that the GPU-side generated data is never used by the host - so why i should write the data in the global memory?

Maxim Milakov
07-19-2011, 09:17 AM
I've read that using local memory is much faster than using global memory. At the moment i use global memory. But the point is, that the GPU-side generated data is never used by the host - so why i should write the data in the global memory?

Global memory - is the main memory of GPU. If it is not needed by host then you just don't copy it to the host.

Local memory is invalidated after all work-items in work-group finish execution. There is no way to use it for passing data between kernel runs. Besides, it is small in size.

Soxda2
07-19-2011, 09:22 AM
ah..ok, that sounds good. Is it still necessary to set the Kernel-Argument for the Kernels which use that buffer?

Maxim Milakov
07-19-2011, 09:25 AM
ah..ok, that sounds good. Is it still necessary to set the Kernel-Argument for the Kernels which use that buffer?

Yes.

Soxda2
07-19-2011, 09:31 AM
Ok, thank you very much. :D