Image manipulation in parallel host threads with gpu

asked 2015-11-19 02:49:03 -0500

com_ws gravatar image

updated 2015-11-24 12:33:56 -0500

Still no answer:
I have two object instances manipulating images in parallel threads on the host Each objects contains members
gpu::GpuMat a;
gpu::GpuMat b;
gpu::GpuMat c;

code is:

gpu_mutex->lock ();
a.upload ( a_data );
b.upload ( b_data );
gpu::subtract ( a, b, c );
c.download ( c_data );
gpu_mutex->unlock ();

I need the Mutex->Lock() around the algorithm to get correctly computed data in "c" in both host threads. My assumption is, that without Mutex the "parallel" upload overwrites the data already in processing.
What is the correct pattern to move multiple data to the gpu and compute the same algorithm in parallel?
I think i need some very basic advise, i'm fairly new to OpenCV.
Thanks!
Wolfram

edit retag flag offensive close merge delete