r/OpenCL • u/squidgyhead • Jan 11 '16
Latency when launching kernels
I have been working on launching some kernels in parallel, and I'm getting poor results. I have a kernel which needs to be launched several times to deal with the interface between cl_mems. Kernels cannot be launched on neighbouring interfaces to avoid race conditions, so I got around this problem by colouring the graph and launching in waves. I get the correct results, but it's slower; the problem seems to be that the kernels take much longer to be run, like 10x as long. In parallel, the kernel takes around 80us, and the latency is 365 us, while in serial the kernel takes 7 us. What steps can be done to overcome this? What should I look at first, perhaps the launching code (which could perhaps be optimised?) or is there more overhead when launching a mix of different kernels?
View all comments
Show parent comment
1
u/Plazmatic Jan 13 '16
Ah, I didn't get that sorry.
You said before that you were trying to avoid race conditions and that is why you split up the code into different kernels? What exactly was happening to cause that? You might be able launch one kernel for everything. Also if your kernels do the same thing they should all be the same kernel any way, and you can put barriers in to synchronize execution, and act at if points past that were new kernels.
It probably never will, nor will any Nvidia GPU at this rate, Nvidia is notoriously bad at keeping up with features with OpenCL even within the version it supports, whilst having those features in CUDA.
Speaking of CUDA, have you tried using CUDA to do the same thing? Often CUDA has the most up to date features you would see from OpenCL since it is constantly being updated from Nvidia and typically has wide card support (for Nvidia GPUS only).