OpenMP relies on #pragma directives. Telling compiler to parallelize loops / code blocks. Change of existing code is small compare to other methods.
_OPENMP will be defined by compiler that supports OpenMP.
Searching _OPENMP from source code discover current 'leftover' implementations here:
- selfsimilarity.cpp (disabled with #if 0 block)
- spinimages.cpp ( parallel for in computeSpinImages() )
- stardetector.cpp ( parallel for in icvStarDetectorComputeResponses() )
- system.cpp (getNumThreads(),...)
- cvboost.cpp ( parallel private in cvCreateMTStumpClassifier() )
- cvhaartraining ( uses CV_OPENMP instead of _OPENMP. Moreover, it's only enabled with MSVC and ICC compilers, not GCC )
- blobtrackanalysisior.cpp: parallel CvBlobTrackAnalysisIOR:Process()
- blobtrackingmsfg.cpp: parallel UpdateWeightsMS(), UpdateWeightsCC()
Experiment with haartraining
- Used Linux Build too take advantage of GCC 4 OpenMP support. There are OpenMP options in MSVC 2010 Express. But Microsoft webpage states there is no support. (http://msdn.microsoft.com/en-us/library/tt15eb9t.aspx)
- Recovered ENABLE_OPENMP in OpenCV 2.2 CMakeFiles by un-commenting such occurrences.
- Used CMake-GUI to configure build with ENABLE_OPENMP turned on.
- Called CvGetNumThreads() in haartraining.cpp to see if both CPU cores are available for use.
- Took half the time to perform the same training. The results are basically the same. Noticeable differences are the node-split threshold values differs from the 5th decimal points on.
- cvhaartraining.cpp uses a variant of the OPENMP define - CV_OPENMP. Training terminated with SegFault with that turned on.