Why is opencv not using all cores after upgrading to Mavericks?

I'm running a CPU intensive command on Mavericks (Opencv_traincasscade). Under Mountain Lion the process used to use all 8 cores all the way though. However after upgrading it drops to 1 core after a short time.

enter image description here

Could this be app nap? Is there anything I can do to fix this?


Being able to use multiple-cores or threads is dependent on the process. This is not AppNap or OS X causing the change.

Your process, opencv_traincascade, may be resource constrained after a few moments and thus reduced to queuing up tasks as it waits for disk access or another limited resource.

In this case you may need to switch to a different build of OpenCV:

Note that opencv_traincascade application can use TBB for multi-threading. To use it in multicore mode OpenCV must be built with TBB.

  • Cascade Classifier Training
  • How do I build OpenCV with TBB?

Installing OpenCV with TBB via brew:

brew install opencv --with-tbb

Graham Miln was correct - the OpenCV installation was wrong.

To verify this:

otool -L /usr/local/lib/libopencv_core.2.4.9.dylib
# Look for libtbb.dylib in the response,
# if missing you need to reinstall with tbb.

To fix this (assuming you installed with homebrew):

brew uninstall opencv
brew info opencv # This will tell you about other flags you might be interested in.
brew install opencv --with-tbb  # Simples! :)