如何使用 ICC 编译 OpenCV?

发布于 2024-08-01 16:31:57 字数 1942 浏览 9 评论 0原文

我正在尝试在 Linux 上使用 icc 编译 OpenCV,以便使用英特尔工具分析执行情况。

我使用默认选项安装了最新版本的 icc。 我尝试了“user”(icc 安装在我家中)和“sudo”(icc 安装在/opt 中)安装。 icc的版本是11.1 20090630

我还想获取iccvars.sh,将所需的路径添加到PATH和LD_LIBRARY_PATH

我还尝试了几个版本的OpenCV: - 主要的:pre1.1。 configure根本无法识别icc -“latest_tested_snapshot”和“trunk”版本:configure可以很好地识别icc(--enable-openmp产生-openmp选项,而不是-fopenmp)

当我制作时,一切看起来都很好,直到编译中间。 然后会出现很多关于“操作员”的警告(也许有一百个)。 这里是一个例子:

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

最后出现错误:

/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

我有人成功用 icc 编译 OpenCV,请告诉我!

I am trying to compile OpenCV with icc on Linux, 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)

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_<float>() const [with
_Tp=float]" will not be called for implicit or explicit conversions
      operator Size_<float>() 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!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

音盲 2024-08-08 16:31:57

好吧,我终于用ICC编译了OpenCV。 OpenCV 与 Intel 关系密切,因为 Intel 高度参与了这个项目。 从 1.1 版本开始,OpenCV 应该原生支持 icc 编译器。 当您在配置中指定 CC=icc 时,会发生一些细微的变化,因为 -fopenmp (gcc 风格)会转换为 -openmp (icc 风格)。 然而,从 OpenCV 1.1(最新稳定版本)发布到现在,icc 已经发生了演变。 我认为它曾经与以前版本的 icc 一起编译。

它与 svn 上最新测试的版本兼容:
https://opencvlibrary.svn.sourceforge.net/svnroot/opencvlibrary /tags/latest_tested_snapshot/opencv/

随着 svn 的发展,它可能会发生变化,但在此时(8 月 27 日)它可以工作。 警告仍然存在(不要害怕,有很多)。 这里是我的配置 bash 行:

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

我禁用了优化和 sse 指令,因为它与 icc 产生了一些冲突。

Ok, I finally compiled OpenCV with ICC. OpenCV is close to Intel, as Intel is highly involved in this project. 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.

吐个泡泡 2024-08-08 16:31:57

您的问题可能是由于使用与用于创建该库的 ICC 不同的版本而导致的。 您必须询问库提供商要使用哪个版本。

Your issue may result from using a different version from ICC used to create that library. You must ask the library provider which version to use.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文