Infinite loop on GPU with CPU usage ?

Hi there,

I have a CUDA (OpenCL) kernel that I should execute a lot of time (100.000 times by examples).

The problem is that :

  1. If I launch everything the GPU lock and my computer freeze. And I cannot stop/pause the GPU once started !!!

  2. If I use a loop on the CPU that launch the GPU kernel, then I have a lot of CPU usage.

I have see a software that run GPU kernels but use 0% of the GPU (Octane Render), how it is possible ?


Partition your work into kernels that are short enough to keep the screen (kind of) responsive, but long enough to not load the CPU significantly.
And then, if you are on Windows using the WDDM driver, call cudaStreamQuery(0) between kernel launches to prevent them from being batched up again, so that the OS gets access to the GPU in between.

Or get a dedicated GPU.

Thanks a lot,

It is not really a solution… I’m not able to divide some kernels to shorters one.
This job is already done :-P

You can easily launch smaller grids though, unless you’ve already reduces that to only a single wave of blocks as well.