Ask Your Question

Async template matching with cuda

asked 2018-04-03 12:04:12 -0500

kiridval gravatar image

updated 2018-04-03 13:17:25 -0500

Hello! Is it possible to execute match() method of two differnt cv::cuda::TemplateMatching instances simultaneously (similar to two CPU threads)? I have tried to pass &stream parameter to cuda::TemplateMatching::match method, seems like:

>match(img1, templ1, result1, stream1); 
>match(img2, templ2, result2, stream2);

But it did not start asynchronously.

My GPU is GTX780Ti.


edit retag flag offensive close merge delete


"does not work the way I want" -- please be more explicit here.

berak gravatar imageberak ( 2018-04-03 12:14:36 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2018-04-04 04:50:02 -0500

If you have one GPU then the answer is no. CUDA functions will execute synchronously on the GPU.

I think you are confusing asynchronous calls, which return control back to the CPU before the CUDA function has completed with multit-threaded execution. The CUDA functions exploit data parallelism, which operates in the same way to SIMD instructions on a CPU, not task parallelism, which allows you to run two instances of a function in separate threads on a CPU.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2018-04-03 12:04:12 -0500

Seen: 306 times

Last updated: Apr 04 '18