A bit of CPU thread reuse help. How to reuse a pool of threads for GPUs?

Hi guys.

I have a question on how to manage a pool of CPU threads. The comments in the SDK multi-GPU examples state:

* Creating CPU threads has a certain overhead. So, this is only worth when you

 * have a significant amount of work to do per thread. It's also recommended to

 * create a pool of threads and reuse them to avoid this overhead.

Unfortunately, the programming guide and reference manual don’t talk about how to create and reuse such pool of threads. Personally, I only have experience with Java threads and CUDA threads.

All multi-GPU examples come with NVIDIA’s multithreading.cpp, which manages CPU thread creation/destruction. Do any of you guys have experience with it? What needs to be done is:

1. Spawn some CPU threads.

2. Each time the user triggers a particular event, the threads start their GPU kernels, and wait until such kernels finish.

3. Keep threads alive, until program exit.

Conceptually, this sounds very basic… but any help with implementing this would be greatly appreciated.


  • Kor