Hardware frame-rate synchronisation?

Is it possible to synchronise CUDA code to the hardware frame rate?

I have an app where I’d like to start a kernel at the start of the frame, process the entire frame, and then wait until the start of the next frame.

Thanks -


You mean the display refresh rate? If you are using OpenGL or Direct3D to display graphics and have vertical-sync enabled, then any interleaved CUDA kernels calls will be synchronized with the display.

It’s a bit more complicated that that, unfortunately. I have no control of what’s on the display, and I don’t write to it myself, but I do need to read and process every pixel on the display once during every frame (yes, at the display refresh rate). The reason is complex, but basically I need to compress the entire display and dump it out on PCIe at frame rate, so that it can be displayed elsewhere at the same frame rate (50/60Hz, or whatever).

So, in short, I need to start my kernel running at some point during the frame and, when the kernel has finished, idle until the same point in the next frame.

Any idea if this is possible? Basically I need a frame-rate interrupt to start the kernel, but this seems to be impossible from my quick reading of the docs. Alternatively, I can use a device driver that runs on host interrupts, but the host interrupt must be locked to the GPU frame rate.