From abdc9e2ec665686e15af6bf208304be57146918a Mon Sep 17 00:00:00 2001 From: "Joshua Z. Zhang" Date: Fri, 3 Aug 2018 15:42:35 -0700 Subject: [PATCH] disable opencv threading for forked process (#12025) --- src/initialize.cc | 6 ++++++ 1 file changed, 6 insertions(+) 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(); });