Ask Your Question
4

Enabling OpenMP while building OpenCV libraries

asked 2013-09-19 02:18:16 -0600

neo_star gravatar image

hi all

I am trying to build libraries for openCV. i see a log in cmake like this

  Other third-party libraries:
    Use IPP:                     NO
    Use Eigen:                   YES (ver 3.2.0)
    Use TBB:                     YES (ver 4.2 interface 7000)
    Use OpenMP:                  NO
    Use GCD                      NO
    Use Concurrency              NO
    Use C=:                      NO
    Use Cuda:                    NO
    Use OpenCL:                  NO

You can see that it has OpenMP switched off. Is there a way to enable it. My platform details are as below :

  Platform:
    Host:                        Windows 6.1 AMD64
    CMake:                       2.8.11.2
    CMake generator:             Visual Studio 11 Win64
    CMake build tool:            C:/Windows/Microsoft.NET/Framework/v4.0.30319/MSBuild.exe
    MSVC:                        1700
edit retag flag offensive close merge delete

Comments

I would like to urge you to stick with similar questions to the same topic. This is in the exact line of the previous one, and an update could have helped you out pretty fast :)

StevenPuttemans gravatar imageStevenPuttemans ( 2013-09-19 04:44:05 -0600 )edit
1

Yes you are correct, but previously i did not know that they are related questions.

neo_star gravatar imageneo_star ( 2013-09-19 05:17:09 -0600 )edit

2 answers

Sort by ยป oldest newest most voted
4

answered 2013-09-19 03:43:52 -0600

berak gravatar image

looking at cmake\OpenCVFindLibsPerf.cmake:91 it seems you can have either tbb or openmp, but not both.

so if you did not enable tbb, a test is run, checking if openmp can be enabled.

also, afaik, you need the VS professional version for openmp support, express comes without the resp. libs.

edit flag offensive delete link more

Comments

Thanks for the clarification. But which is preferable with say, VS2013, which has OpenMP 2.0, and TBB 4.2? More specifically, two questions: Do more OpenCV functions support one over the other, and which gives better performance?

chappjc gravatar imagechappjc ( 2014-08-04 17:45:38 -0600 )edit
2

answered 2013-10-20 23:40:58 -0600

charpentier franck gravatar image

I open a bug : http://code.opencv.org/issues/3328

Workaround: Replace line 49 to 58 in file opencv-2.4.6.1/cmake/OpenCVFindLibsPerf.cmake :

# --- OpenMP ---
if(NOT HAVE_TBB AND NOT HAVE_CSTRIPES)
  include (FindOpenMP)      # --- since cmake version 2.6.3 
   if (OPENMP_FOUND)
      set (HAVE_OPENMP TRUE)
      set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
      set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
   else()
      set ( HAVE_OPENMP FALSE)
   endif()
else()
set(HAVE_OPENMP 0)
endif()
edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2013-09-19 02:18:16 -0600

Seen: 8,827 times

Last updated: Oct 20 '13