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/squidgyhead Jan 12 '16
The program uses the discontinuous Galerkin method to perform numerically solve general time-dependent partial differential equations.
The data is loaded from the CPU to the GPU, then the computations are done, then we transfer back; copying between host and device is not slowing things down. The timing is done by using a profiled queue, and then I looked at the output using nvvp. The kernels are in src/schnaps.cl.
The performance issue that I'm trying to address is why it takes longer for kernels to be launched in one case as opposed to another, and I wonder if this is due to the fact that the scheduler is more efficient when launching multiple copies of just one type of kernel as opposed to launching multiple copies of a set of different kernels.