OpenCV compilation with Intel C++ Compiler

OpenCV compilation with Intel C++ Compiler

Which compiler flags should be used for OpenCV compilation to get best performance from library?

I want to benefit from vectorization properties of compiler and want machine code of OpenCV which fully benefits SSE and AVX instructions.

At least some clues about this issue will be fine for me.

9 帖子 / 0 全新
最新文章
如需更全面地了解编译器优化,请参阅优化注意事项

>>Which compiler flags should be used for OpenCV compilation to get best performance from library?..

It would be nice to see a set of Intel C++ compiler options you currently use. Take into account that some Intel C++ compiler options are turned on by default and use icl.exe -help. Here is a list you could try:

/O3
/QaxSSE2 and /QaxAVX
/Qvec
/Qstd=c99
/Qrestrict
/Qansi-alias
/Qipo
/Qunroll=8
/Qopt-block-factor:3
/Qopt-mem-layout-trans:3
/Qopt-prefetch:4

Here are two sets of compiler options to be considered:

[ Intel C++ compiler ]

/O3
/Oi
/Ot
/Oy
/GF
/MT
/GS-
/fp:fast=2
/W5
/Wp64
/Zi
/Gr
/TP
/Qopenmp
/Qfp-speculation:fast
/Qopt-matmul
/Qparallel
/Qstd=c++0x
/Qrestrict
/Qunroll:4
/Qopt-block-factor:64
/Qopt-streaming-stores:auto

[ Microsoft C++ compiler ]

/O2
/Oi
/Ot
/Oy
/GF
/Gm
/MT
/GS-
/fp:fast
/openmp
/W4
/Wp64
/Zi
/TP
/errorReport:prompt

Note: /Ox ( Full Optimization ) could be used instead of /O2

I will give them a try and share the results, thank you so much.

>>...I will give them a try and share the results...

The best way to continue is to add, or change, one option at a time with verification in Release Configuration that performance doesn't get worse. If you try all of them at the same time and performance gets worse then you won't know which option(s) is responsible for negative impact.

Himm that's a very good idea. I will give them try in a batch. Whenever I complete my profiler, I will compile different builds of OpenCV by using this way and profile these different builds. I will share profiler results with you.

Thank you so much for your concern.

Is there any recommendations based on personal experience? I'm currently compiling opencv with icc and would appreciate any pointers. 

thanks

iliyapolak的头像

Try to compile openCV programs with various compiler settings and later test your code with Intel VTune profiler.

iliyapolak的头像

 

>>>fp:fast=2>>>

Instead of /fp:fast compiler option you can use more safe /fp:precise. 

登陆并发表评论。