Intel® Integrated Performance Primitives
Deliberate problems developing high-performance vision, signal, security, and storage applications.

OpenCV is not showing improvement when running with IPP

eitan_s_
Начинающий
7 101Просмотр.

Hi All,

I installed latest IPP product and I have video processing code in OpenCV. I recompiled OpenCV with flag WITH_IPP however I don't see any performance improvement. What I'm missing ? How can I tell OpenCV is detecting the IPP ?

0 баллов
1 Решение
Pavel_V_Intel
Сотрудник
7 125Просмотр.
26 Ответы
Jing_Xu
Сотрудник
5 555Просмотр.

Hi,

You may enable IPP on OpenCV by passing switches "-D WITH_IPP=ON -D IPPROOT=<Your IPP Location>" to cmake command like the following. 

cmake -D WITH_IPP=ON -D IPPROOT=<Your IPP Location> .

For more detailed information, please refer to https://software.intel.com/en-us/articles/enabling-ipp-on-opencv-windows-and-linux-ubintu

/* ****************************************** */

To confirm how your OpenCV works with IPP, please check in version_string.tmp under your OpenCV build directory.

Suppose you follow the following official OpenCV installation guide, you will find the version_string.tmp under ~/opencv/release.

  1. Create a temporary directory, which we denote as <cmake_binary_dir>, where you want to put the generated Makefiles, project files as well the object files and output binaries.

  2. Enter the <cmake_binary_dir> and type

    cmake [<some optional parameters>] <path to the OpenCV source directory>
    

    For example

    cd ~/opencv
    mkdir release
    cd release
    cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local ..
    
  3. Enter the created temporary directory (<cmake_binary_dir>) and proceed with:

    make
    sudo make install
eitan_s_
Начинающий
5 555Просмотр.

Thanks for reply. Still not working.

I got the version_string.tmp file.

Why I see ?

Use IPP:                     IPP not found or implicitly disabled\n"

 

"\n"
"General configuration for OpenCV 3.1.0 =====================================\n"
"  Version control:               unknown\n"
"\n"
"  Platform:\n"
"    Host:                        Linux 4.4.0-59-generic x86_64\n"
"    CMake:                       3.5.1\n"
"    CMake generator:             Unix Makefiles\n"
"    CMake build tool:            /usr/bin/make\n"
"    Configuration:               RELEASE\n"
"\n"
"  C/C++:\n"
"    Built as dynamic libs?:      YES\n"
"    C++ Compiler:                /usr/bin/c++  (ver 5.4.0)\n"
".........................
"\n"
"  Video I/O:\n"
"    DC1394 1.x:                  NO\n"
"    DC1394 2.x:                  NO\n"
"    FFMPEG:                      YES\n"
"      codec:                     YES (ver 56.60.100)\n"
"      format:                    YES (ver 56.40.101)\n"
"      util:                      YES (ver 54.31.100)\n"
"      swscale:                   YES (ver 3.1.101)\n"
"      resample:                  NO\n"
"      gentoo-style:              YES\n"
"    GStreamer:                   NO\n"
"    OpenNI:                      NO\n"
"    OpenNI PrimeSensor Modules:  NO\n"
"    OpenNI2:                     NO\n"
"    PvAPI:                       NO\n"
"    GigEVisionSDK:               NO\n"
"    UniCap:                      NO\n"
"    UniCap ucil:                 NO\n"
"    V4L/V4L2:                    NO/YES\n"
"    XIMEA:                       NO\n"
"    Xine:                        NO\n"
"    gPhoto2:                     NO\n"
"\n"
"  Parallel framework:            pthreads\n"   
"\n"
"  Other third-party libraries:\n"
"    Use IPP:                     IPP not found or implicitly disabled\n"
"    Use IPP Async:               NO\n"
"    Use VA:                      NO\n"
"    Use Intel VA-API/OpenCL:     NO\n"
"    Use Eigen:                   NO\n"
"    Use Cuda:                    NO\n"
"    Use OpenCL:                  YES\n"
"    Use custom HAL:              NO\n"

"\n"
"  OpenCL:\n"
"    Version:                     dynamic\n"
"    Include path:                /home/eitans/opencv-3.1.0/3rdparty/include/opencl/1.2\n"
"    Use AMDFFT:                  NO\n"
"    Use AMDBLAS:                 NO\n"
"\n"........

Jing_Xu
Сотрудник
5 555Просмотр.

Your log indicates that OpenCV was not built with IPP support.

Please follow the following steps to compile OpenCV with IPP.

Suppose your root directory of IPP is <IPPROOT>. It should be similar to "/opt/intel/compilers_and_libraries(_2017 or _2017.x.yyy or null)/linux/ipp".

  1. Create a temporary directory, which we denote as <cmake_binary_dir>, where you want to put the generated Makefiles, project files as well the object files and output binaries.

  2. Enter the <cmake_binary_dir> and type

    cmake [<some optional parameters>] <path to the OpenCV source directory>

    For example

    cd ~/opencv
    mkdir release
    cd release
    cmake -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_INSTALL_PREFIX=/usr/local -DWITH_IPP=ON -DIPPROOT=<IPPROOT> ..
  3. Enter the created temporary directory (<cmake_binary_dir>) and proceed with:

    make
    sudo make install

If these do not work for your compiling, could you share more detailed information like your command line history to compile OpenCV, and where is your IPP root directory, and so on, please?

eitan_s_
Начинающий
5 555Просмотр.

Specified DIPPROOT=/opt/intel/ipp

Now a version is detected but I'm getting failure.

Any advise how to resolve those ?

 

-- found IPP: 2017.0.0 [2017.0.0]
-- at: /opt/intel/ipp
-- Can't find IPP library: m at /opt/intel/ipp/lib/intel64/libippm.a
CMake Error at cmake/OpenCVFindIPP.cmake:204 (message):
  Intel compiler EM64T libraries not found
Call Stack (most recent call first):
  cmake/OpenCVFindIPP.cmake:254 (ipp_detect_version)
  cmake/OpenCVFindLibsPerf.cmake:37 (include)
  CMakeLists.txt:562 (include)


-- Can't find compiler library: irc at /opt/intel/compilers_and_libraries_2017.0.098/linux/compiler/lib/intel64/libirc.so
-- Can't find compiler library: imf at /opt/intel/compilers_and_libraries_2017.0.098/linux/compiler/lib/intel64/libimf.so
-- Can't find compiler library: svml at /opt/intel/compilers_and_libraries_2017.0.098/linux/compiler/lib/intel64/libsvml.so

Jing_Xu
Сотрудник
5 555Просмотр.

Could you share us your compiling command history, CMakeCache.txt and version_string.tmp with us, please? (Starting from unzip opencv from the zip file)

Besides, did you install the IPP with Intel System Studio or Intel Parallel Studio or using standalone package?

eitan_s_
Начинающий
5 555Просмотр.

The main command I'm using is:

cmake -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_INSTALL_PREFIX=/usr/local -DWITH_IPP=ON -DIPPROOT=/opt/intel/ipp ..

 

Also attached the requested files.

 

Thanks, Eitan

Jing_Xu
Сотрудник
5 555Просмотр.

It seems to be all right from these two files.

Have you tried to run make to compile OpenCV after the cmake command?

eitan_s_
Начинающий
5 555Просмотр.

yes, make command fail.

Notice that I have errors for cmake

Maybe I install IPP incorrectly ?

How can I check that IPP is install correctly ?

Can you point me to the install instructions for IPP over ubuntu ?

 

-- Checking for module 'libavresample'
--   No package 'libavresample' found
-- Checking for module 'libgphoto2'
--   No package 'libgphoto2' found
-- found IPP: 2017.0.0 [2017.0.0]
-- at: /opt/intel/ipp
-- Can't find IPP library: m at /opt/intel/ipp/lib/intel64/libippm.a
CMake Error at cmake/OpenCVFindIPP.cmake:204 (message):
  Intel compiler EM64T libraries not found
Call Stack (most recent call first):
  cmake/OpenCVFindIPP.cmake:254 (ipp_detect_version)
  cmake/OpenCVFindLibsPerf.cmake:37 (include)
  CMakeLists.txt:562 (include)


-- Can't find compiler library: irc at /opt/intel/compilers_and_libraries_2017.0.098/linux/compiler/lib/intel64/libirc.so
-- Can't find compiler library: imf at /opt/intel/compilers_and_libraries_2017.0.098/linux/compiler/lib/intel64/libimf.so
-- Can't find compiler library: svml at /opt/intel/compilers_and_libraries_2017.0.098/linux/compiler/lib/intel64/libsvml.so

eitan_s_
Начинающий
5 555Просмотр.

attaching cmake output and error log files

Pavel_V_Intel
Сотрудник
5 555Просмотр.

Hi Eitan,

-- Can't find compiler library: irc at /opt/intel/compilers_and_libraries_2017.0.098/linux/compiler/lib/intel64/libirc.so
-- Can't find compiler library: imf at /opt/intel/compilers_and_libraries_2017.0.098/linux/compiler/lib/intel64/libimf.so
-- Can't find compiler library: svml at /opt/intel/compilers_and_libraries_2017.0.098/linux/compiler/lib/intel64/libsvml.so

These libraries shouldn't be required for IPP 2017, build scripts are a little out of date.

yes, make command fail.

Can you also attach your make log?

 

eitan_s_
Начинающий
5 555Просмотр.

The main problem is that I'm not getting a Makefile so I can't run make :(

-- found IPP: 2017.0.0 [2017.0.0]
-- at: /opt/intel/ipp
-- Can't find IPP library: m at /opt/intel/ipp/lib/intel64/libippm.a
CMake Error at cmake/OpenCVFindIPP.cmake:204 (message):
  Intel compiler EM64T libraries not found
Call Stack (most recent call first):
  cmake/OpenCVFindIPP.cmake:254 (ipp_detect_version)
  cmake/OpenCVFindLibsPerf.cmake:37 (include)
  CMakeLists.txt:562 (include)

 

eitan_s_
Начинающий
5 555Просмотр.

The macro in cmake file OpenCVFindIPP.cmake that fail when called with name='m'

 macro(_ipp_add_library name)
    # dynamic linking is only supported for standalone version of IPP
    if (BUILD_WITH_DYNAMIC_IPP AND NOT HAVE_IPP_ICV_ONLY)
      set(IPP_LIB_PREFIX ${CMAKE_SHARED_LIBRARY_PREFIX})
      set(IPP_LIB_SUFFIX ${CMAKE_SHARED_LIBRARY_SUFFIX})
    else ()
      set(IPP_LIB_PREFIX ${CMAKE_STATIC_LIBRARY_PREFIX})
      set(IPP_LIB_SUFFIX ${CMAKE_STATIC_LIBRARY_SUFFIX})
    endif ()
    if (EXISTS ${IPP_LIBRARY_DIR}/${IPP_LIB_PREFIX}${IPP_PREFIX}${name}${IPP_SUFFIX}${IPP_LIB_SUFFIX})
      if (BUILD_WITH_DYNAMIC_IPP AND NOT HAVE_IPP_ICV_ONLY)
        # When using dynamic libraries from standalone IPP it is your responsibility to install those on the target system
        list(APPEND IPP_LIBRARIES ${IPP_LIBRARY_DIR}/${IPP_LIB_PREFIX}${IPP_PREFIX}${name}${IPP_SUFFIX}${IPP_LIB_SUFFIX})
      else ()
        add_library(ipp${name} STATIC IMPORTED)
        set_target_properties(ipp${name} PROPERTIES
          IMPORTED_LINK_INTERFACE_LIBRARIES ""
          IMPORTED_LOCATION ${IPP_LIBRARY_DIR}/${IPP_LIB_PREFIX}${IPP_PREFIX}${name}${IPP_SUFFIX}${IPP_LIB_SUFFIX}
        )
        list(APPEND IPP_LIBRARIES ipp${name})
        if (NOT BUILD_SHARED_LIBS)
          # CMake doesn't support "install(TARGETS ${IPP_PREFIX}${name} " command with imported targets
          install(FILES ${IPP_LIBRARY_DIR}/${IPP_LIB_PREFIX}${IPP_PREFIX}${name}${IPP_SUFFIX}${IPP_LIB_SUFFIX}
                  DESTINATION ${OPENCV_3P_LIB_INSTALL_PATH} COMPONENT dev)
          string(TOUPPER ${name} uname)
          set(IPP${uname}_INSTALL_PATH "${CMAKE_INSTALL_PREFIX}/${OPENCV_3P_LIB_INSTALL_PATH}/${IPP_LIB_PREFIX}${IPP_PREFIX}${name}${IPP_SUFFIX}${IPP_LIB_SUFFIX}" CACHE INTERNAL "" FORCE)
          set(IPP${uname}_LOCATION_PATH "${IPP_LIBRARY_DIR}/${IPP_LIB_PREFIX}${IPP_PREFIX}${name}${IPP_SUFFIX}${IPP_LIB_SUFFIX}" CACHE INTERNAL "" FORCE)
        endif()
      endif()
    else()
      message(STATUS "Can't find IPP library: ${name} at ${IPP_LIBRARY_DIR}/${IPP_LIB_PREFIX}${IPP_PREFIX}${name}${IPP_SUFFIX}${IPP_LIB_SUFFIX}")
    endif()
  endmacro()

eitan_s_
Начинающий
5 555Просмотр.

By the way when dropping "DIPPROOT" and just running - cmake -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_INSTALL_PREFIX=/usr/local -DWITH_IPP=ON ..    than cmake works well and also make.

Other third-party libraries:
--     Use IPP:                     9.0.1 [9.0.1]
--          at:                     /home/eitans/opencv/build/3rdparty/ippicv/ippicv_lnx
--     Use IPP Async:               NO
--     Use VA:                      NO
--     Use Intel VA-API/OpenCL:     NO
--     Use Lapack:                  NO
--     Use Eigen:                   NO
--     Use Cuda:                    NO
--     Use OpenCL:                  YES   
--     Use OpenVX:                  NO
--     Use custom HAL:              NO

The problem in that case is that I don't see any improvement later on when using OpenCV and so I assume it is not using the IPP product :(

eitan_s_
Начинающий
5 555Просмотр.

Looking more in OpenCVFindIPP.cmake I see difference between ICV and standalone IPP

Any idea why we have this difference ?

We are failing on     _ipp_add_library(m)

=======================

if(HAVE_IPP_ICV_ONLY)
    _ipp_add_library(icv)
  else()
    _ipp_add_library(core)
    _ipp_add_library(s)
    _ipp_add_library(i)
    _ipp_add_library(cc)
    _ipp_add_library(cv)
    _ipp_add_library(vm)
    _ipp_add_library(m)

=======================

 

eitan_s_
Начинающий
5 555Просмотр.
eitan_s_
Начинающий
5 555Просмотр.
Pavel_V_Intel
Сотрудник
5 555Просмотр.

You are using release OpenCV 3.1, right? Can you update to 3.2? As I remember there were compatibility updates for IPP 2017. I can configure OpenCV 3.2 with IPP 2017.0.0 without any problem. There are some building problems, but I can help to fix them.

Other third-party libraries:
--     Use IPP:                     9.0.1 [9.0.1]
--          at:                     /home/eitans/opencv/build/3rdparty/ippicv/ippicv_lnx

 

The problem in that case is that I don't see any improvement later on when using OpenCV and so I assume it is not using the IPP product :(

This is a special IPP package for OpenCV which downloads by default. It has some limitations, but there is no guaranty that you are using any OpenCV function with IPP optimizations at all.

You can check performance difference by using cv::ipp::setUseIPP(bool) function before OpenCV calls.

eitan_s_
Начинающий
5 555Просмотр.

After removing the library _ipp_add_library(m) I'm getting error around

message(SEND_ERROR "Intel compiler EM64T libraries not found")

I think the problem is that I'm missing soft link under:   /opt/intel/lib

intel64 ==> intel64_lin

so I added it

eitan_s_
Начинающий
5 555Просмотр.

Now after make finish I'm getting error:

 

../../lib/libopencv_core.so.3.2.0: undefined reference to `n8_ownsAdd_8u_Bound'
collect2: error: ld returned 1 exit status
apps/version/CMakeFiles/opencv_version.dir/build.make:105: recipe for target 'bin/opencv_version' failed
make[2]: *** [bin/opencv_version] Error 1
CMakeFiles/Makefile2:6905: recipe for target 'apps/version/CMakeFiles/opencv_version.dir/all' failed
make[1]: *** [apps/version/CMakeFiles/opencv_version.dir/all] Error 2
Makefile:160: recipe for target 'all' failed
make: *** [all] Error 2

eitan_s_
Начинающий
5 049Просмотр.

Regarding ICV you wrote:

This is a special IPP package for OpenCV which downloads by default. It has some limitations, but there is no guaranty that you are using any OpenCV function with IPP optimizations at all.

[EITANS]  "there is no guaranty" .... is that a general statement or only when using ICV ?

 

You can check performance difference by using cv::ipp::setUseIPP(bool) function before OpenCV calls.

[EITANS] Can you elaborate how to use it and what does it tells me ?

Ответить