Ask Your Question

cv::solve OpenCV 3.1 vs. 3.2 speed

asked 2017-08-08 06:06:31 -0500

Kostas gravatar image

Dear OpenCV community

I decided to change to 3.2 but realized that in this version the cv::solve with DECOMP_QR is much slower than in 3.1. I observed increase even from 400ms to 12sec for large matrices.

I am using the standard configuration of OpenCV, with OpenCl and AVX2, on an i7 4770, without GPU . My question: is there a difference in using OpenCV 3.2 in comparison to 3.1? I could imagine there are some changes in the optimization of the code, but do I need to activate/deactivate something?

Finally, is there currently an optimal configuration for modern Intel i7 to gain maximum performance (without CUDA)?


edit retag flag offensive close merge delete


Is it possible to add a minimal reproducible code with data? Otherwise, what is the size of the matrix? Did you observe this discrepancy for certain values of matrix (e.g. matrix singularity) or the values did not matter?

After a quick look to the source code, it looks like DECOMP_QR method is instead replaced by DECOMP_SVD in 3.1. To test this, can you try with DECOMP_SVD with 3.2 version if it is possible?

In 3.2, DECOMP_QR seems enabled and should use LAPACK to do that. To get the best performance on an Intel processor, I would recommand to use Intel MKL or OpenBLAS.

Eduardo gravatar imageEduardo ( 2017-08-08 16:18:55 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2017-08-10 06:36:27 -0500

Kostas gravatar image

Thanks Eduardo, I also observed the same, there is a new QR implementation in 3.2, while in 3.1 the SVD implementation is internally used. I am using SVD now in 3.2 and the computation time returned back to "normal". For some reason the new QR implementation is slow.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2017-08-08 06:06:31 -0500

Seen: 370 times

Last updated: Aug 10 '17