diff --git a/src/initialize.cc b/src/initialize.cc index 1fd92628e9b2..342b0ee0141b 100644 --- a/src/initialize.cc +++ b/src/initialize.cc @@ -26,6 +26,9 @@ #include #include #include "./engine/openmp.h" +#if MXNET_USE_OPENCV +#include +#endif // MXNET_USE_OPENCV namespace mxnet { #if MXNET_USE_SIGNAL_HANDLER && DMLC_LOG_STACK_TRACE @@ -57,6 +60,9 @@ class LibraryInitializer { // Make children single threaded since they are typically workers dmlc::SetEnv("MXNET_CPU_WORKER_NTHREADS", 1); dmlc::SetEnv("OMP_NUM_THREADS", 1); +#if MXNET_USE_OPENCV + cv::setNumThreads(0); // disable opencv threading +#endif // MXNET_USE_OPENCV engine::OpenMP::Get()->set_enabled(false); Engine::Get()->Start(); });