Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.
7956 Discussions

How to comile OpenCV with icpc?

Jérôme
Beginner
584 Views
I am trying to compile OpenCV with icc on Linux Debian, in order to profile the execution with intel tools.

I installed the last version of icc with default options. I tried both "user" (icc is installed in my home) and "sudo" (icc is intalled in /opt) installs. The version of icc is 11.1 20090630

I also thought to source iccvars.sh, adding needed paths to PATH and LD_LIBRARY_PATH

I also tried several versions of OpenCV:
- the main one: pre1.1. configure does not recognize icc at all
- the 'latest_tested_snapshot' and the 'trunk' versions: icc is well recognized by configure (--enable-openmp produce -openmp option, and not -fopenmp)

Here my configure line:
./configure --prefix=/home/jerome/opencv/icc CXX=icpc CC=icc --enable-openmp

All I found is related to problem to compile OpenCV on MacOS platform. Maybe I only forgot about something...

When I make, everything seems all right until the middle of the compilation. Then come a lot of warnings (maybe a hundred) always about 'operator'. Here an example:

../include/opencv/cxcore.hpp(335): warning #597: "cv::Size_<_Tp>::operator cv::Size_() const [with
_Tp=float]" will not be called for implicit or explicit conversions
operator Size_() const;
^
detected during instantiation of class "cv::Size_<_Tp> [with _Tp=float]" at line 394

And finnally the error:

/bin/bash ../../../libtool --tag=CXX --mode=compile icpc -DHAVE_CONFIG_H -I. -I../../.. -I../../../include/opencv -I. -DCV_NO_BACKWARD_COMPATIBILITY -fPIC -I/usr/include/python2.6 -g -O2 -MT _highgui_la-pyhelpers.lo -MD -MP -MF .deps/_highgui_la-pyhelpers.Tpo -c -o _highgui_la-pyhelpers.lo `test -f 'pyhelpers.cpp' || echo './'`pyhelpers.cpp
_ml.cpp(36134): error: argument of type "uchar={unsigned char} *" is incompatible with parameter of type "int *"
result = (int)(arg1)->get_ord_var_data(arg2,arg3,arg4,arg5,(float const **)arg6,(uchar const **)arg7);
^

_ml.cpp(36134): error: argument of type "const uchar={unsigned char} **" is incompatible with parameter of type "const int **"
result = (int)(arg1)->get_ord_var_data(arg2,arg3,arg4,arg5,(float const **)arg6,(uchar const **)arg7);
^

compilation aborted for _ml.cpp (code 2)
make[4]: *** [_ml_la-_ml.lo] Erreur 1

I anyone succeded to compile OpenCV with icc, let me know!

0 Kudos
2 Replies
TimP
Honored Contributor III
584 Views
g++ should work fine with Intel profiling tools. As with icpc, you would set -g and your desired optimizations. The exception would be that libiomp5prof, although working with g++, would not identify specific parallel regions.
The warnings and error report may be associated with your g++ installation, if it is stricter than what the source was developed with. icpc uses the headers provided by g++. Were you able to build with that g++ (possibly adding -fpermissive) ? If not, consult OpenCV bug report site.
0 Kudos
Jérôme
Beginner
584 Views
Quoting - tim18
g++ should work fine with Intel profiling tools.

g++ -g compilation is not enough if I want to use Intel tool like ThreadChecker.

==

I finally compiled OpenCV with ICC. Since version 1.1, OpenCV is supposed to natively support icc compiler. When you specify CC=icc in configure, there are some subtle changes as the -fopenmp (gcc style) in transformed into -openmp (icc style). However, between the release of OpenCV 1.1 (which is the latest stable) and now, icc has evolved. I think it used to compile with previous version of icc.

It comile with the latest tested version on svn: https://opencvlibrary.svn.sourceforge.net/svnroot/opencvlibrary/tags/latest_tested_snapshot/opencv/

As the svn evolve, it could change, but at this time (27 august) it works. The warnings are still here (don't be affraid, there are a lot). Here my configure bash line:

./configure --prefix=/home/user/opencv/icc CC=icc CXX=icpc --enable-openmp --disable-apps --disable-optimization --disable-sse

I disabled optimizations and sse instructions, as it generates some conflicts with icc.

0 Kudos
Reply