You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by zh...@apache.org on 2018/08/03 22:42:42 UTC

[incubator-mxnet] branch master updated: disable opencv threading for forked process (#12025)

This is an automated email from the ASF dual-hosted git repository.

zhasheng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git


The following commit(s) were added to refs/heads/master by this push:
     new ae698f9  disable opencv threading for forked process (#12025)
ae698f9 is described below

commit ae698f9598d88118b0c96cae3965dd2375884562
Author: Joshua Z. Zhang <ch...@gmail.com>
AuthorDate: Fri Aug 3 15:42:35 2018 -0700

    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 1fd9262..342b0ee 100644
--- a/src/initialize.cc
+++ b/src/initialize.cc
@@ -26,6 +26,9 @@
 #include <dmlc/logging.h>
 #include <mxnet/engine.h>
 #include "./engine/openmp.h"
+#if MXNET_USE_OPENCV
+#include <opencv2/opencv.hpp>
+#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();
       });