TAPI -> no performance gain

asked 2017-03-16 11:11:26 -0500

iko79 gravatar image

updated 2017-03-16 11:19:01 -0500

TAPI absolute beginner here. I ported my CV code to make use of UMat intstead of Mat since my CPU was on it's limit, especially morphologic operations seemed to consume quite some computing power.

I cannot see any changes in my framerate, it is exactly the same no matter if I use TAPI or not, also Process Explorer reports no GPU usage whatsoever. I did a small test with a few calls of dilation and closing on a full HD image -- no effect.

Did I miss something I have to do in order to enable TAPI? I'm using the latest OpenCV 3.2 build for Windows and a GTX 980 with driver 378.49. cv::ocl::haveOpenCL() and cv::ocl::useOpenCL() both return true and cv::ocl::Context::getDefault().device( 0 ) also gives me the correct device, everything looks good.

Any ideas? Are there any how-to's, best practices or common pitfalls for using TAPI?

edit retag flag offensive close merge delete


Best guess, you are using prebuilt packages. They have no builtin opencl and cuda support. You have to build from sources and enable it.

StevenPuttemans gravatar imageStevenPuttemans ( 2017-03-16 13:02:03 -0500 )edit

idk, like I said cv::ocl::haveOpenCL() tells me it was built with OpenCL support. Also, I'm using some custom CL code with cv::ocl::Kernel which definitely is invoked. In the OpenCV source code I saw that, if built with HAVE_OPENCL, the functions try to run CL code using the CV_OCL_RUN macro, however there are a few conditions checked beforehand, otherwise it falls back to CPU. It does not seem like I have any possitility to figure out if the GPU or the CPU was actually used but stepping into each and every OpenCL function with the debugger, am I right?

iko79 gravatar imageiko79 ( 2017-03-17 04:11:12 -0500 )edit

you can try this program to test your configuration

LBerger gravatar imageLBerger ( 2017-03-17 04:14:15 -0500 )edit