Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Commit

Permalink
disable opencv threading for forked process (#12025)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhreshold authored and szha committed Aug 3, 2018
1 parent 3910c08 commit ae698f9
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/initialize.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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();
});
Expand Down

0 comments on commit ae698f9

Please sign in to comment.