OpenCL finer grained follow up

Hello! I have already asked a question about OpenCL. I am working with an Intel Haswell processor and I was wondering whether it is possible to flush the data from the kernel while this is still running. When I am saying flushing I am meaning flushing the data back to main memory so that other devices can see it.


No. In OpenCL 1.x, while the kernel is running it owns the memory it is writing to and there is no guarantee of consistency if read from the host. In OpenCL 2.0 one of the SVM modes allows for memory access consistency, but no driver supports it yet.

Perhaps your problem can utilize a double-buffering scheme where the kernel writes one buffer while the host reads another.

Thanks for the info.

I am using a double buffering scheme, but the issue is that I want to launch the kernel once and never exit the kernel until all the operations are done. In other words. In other words, I need the sync points within the kernel because otherwise I will have to offload the kernel multiple times to the GPU, which I would not like to do.

Thanks once again.

Not possible. In fact, on most hardware if the kernel runs for more than a short time the OS will kill it. OpenCL is not designed for continuously running kernels. What you can do instead is continuously feed small kernels in sync with your analysis of the results of the previous kernels. This will still keep the GPU busy, but with many kernels (or many iterations of the same kernel) instead of one kernel running continuously.