Ask Your Question
0

GPU HOUGH in multithreading applications

asked 2013-09-10 04:21:36 -0500

MarcusCola gravatar image

updated 2013-09-17 01:58:36 -0500

berak gravatar image

Hi guys, well done! OpenCV is fantastic! I say this because i'm working with other image processing library and OpenCV is the top!

But i wonder, why doesn't GPU HoughCircle function support use for GPU Stream?

I'm working on a multithreading Qt project and i need to start more CPU thread on one GPU in order to perform Hough Transformation. But, without stream this is not possible! Is it right!?

Thanks a lot! Have a good job

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
1

answered 2013-09-10 06:46:29 -0500

Vladislav Vinogradov gravatar image

gpu::HoughCircle calls gpu::Canny, which doesn't supports Streams too.

Both algorithms contains several stages and requires memory transfers from GPU to CPU between the stages. That creates synchronization points inside algorithm implementation, so it can't be asynchronous. Asynchronous support requires implementation modification.

As for your question, I'm not sure, if I understand you correctly. If you want to do some work on CPU parallel with GPU, you can create two host threads, launch GPU function in the first thread and CPU function in the second thread.

edit flag offensive delete link more

Comments

Hi Vladislav, thank you for you replay. I have not been too clear, the problem is: i have more CPU thread; each thread has to use GPU in real time. So GPU has to create more context and switch from one context to another one. But it seems that this is not done automatically and the program crashes if more CPU thread use GPU OpenCV function.

MarcusCola gravatar imageMarcusCola ( 2013-09-11 04:00:16 -0500 )edit
0

answered 2013-09-17 01:54:19 -0500

MarcusCola gravatar image

THE PROBLEM: i have more CPU thread; each thread has to use OpneCV GPU function in real time. So GPU has to create more context and switch from one context to another one, before calling OpenCV function.

SOLUTION: Manually create context (cuCtxCreate) for each thread, pop the previous one from the stack and push the new context. Execute function on GPU. Pop current context.

At the end, delete context. For all this function (create, pop, push and destroy) use CUDA routines.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

Stats

Asked: 2013-09-10 04:21:36 -0500

Seen: 617 times

Last updated: Sep 17 '13