release cpu while gpu processes data


Is it possible to free host while host is idle and gpu calculates stuff?
I transfer some hdd sectors to gpu for processing (crc calculation) and return the crc value to host.
is there any way while gpu calculates, to release cpu in order to be available to other apps and when gpu has finished to call cpu (with some flag or stg similar).
I think it is useful to mention that I use streams for overlapping data transfers and kernel execution and page-locked memory for the data transfer.

I have searched a lot and haven’t found anything relative, so should I suppose that it is not possible to release cpu?


You can change the CPU scheduling behavior with cudaSetDeviceFlags().

I read (at programming guide I think) that kernel launches are non blocking and that once the kernel is launched the cpu is free to do other things.
So, what I want is the default behaviour? After any kernel launch the cpu is “free”?

If I dont miss your question, you want release the CPU for other ‘apps’ ? Do you mean other application running in the same operating system?.

As you commented, once the kernel is launched the cpu is free to do other things. I think this is related to your current program. If the CPU is free / idle due to a GPU computing in your application, would be the responsibility of the operating system use it for other things.

It’s just an assumption but maybe it helps.


Yes, the CPU thread executing your program will be free to do other work. It will continue executing your program, which may have some CPU intensive code after launching the kernel. If your program does not supply any CPU work, the program flow will run into a synchronization point with the GPU (cudaThreadSynchronize() cudaMemcpy() device->host, …). The latter will by default spin, keeping the CPU busy and not yielding it to other apps.

So with the default setting your code will either use the CPU itself or just busy-wait, but it will not yield the CPU to other programs. cudaSetDeviceFlags() can change this behavior.

Now everything became clear!
Thanks a lot both of you