Building OpenCV with AVX-2 (or AVX-512 support)?

asked 2017-05-27 08:52:27 -0600

lovaj gravatar image

I want to build OpenCV 3.2 for AVX-2 support. By using -DENABLE_AVX2=ON and using gcc I get these compiler flags:

-msse -msse2 -mno-avx -mavx2

But following this I should use -DCPU_BASELINE=AVX2, but then I get these compiler flags:

-msse -msse2 -mno-avx -msse3 -mno-ssse3 -mno-sse4.1 -mno-sse4.2

What is the correct way to do this?

In addition, I have a AVX-512 compatible machine (Intel KNL) and I would obtain even better performances if I could build it using these set of instructions. I've seen here some trace of 512 stuff, but I can't understand how could I use it.

edit retag flag offensive close merge delete