You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2019/07/02 06:14:34 UTC

[GitHub] [incubator-mxnet] anirudh2290 commented on a change in pull request #15379: Use omp threads for cpu data loader

anirudh2290 commented on a change in pull request #15379: Use omp threads for cpu data loader
URL: https://github.com/apache/incubator-mxnet/pull/15379#discussion_r299316180
 
 

 ##########
 File path: src/io/iter_image_recordio_2.cc
 ##########
 @@ -134,19 +134,25 @@ inline void ImageRecordIOParser2<DType>::Init(
   record_param_.InitAllowUnknown(kwargs);
   batch_param_.InitAllowUnknown(kwargs);
   normalize_param_.InitAllowUnknown(kwargs);
+  PrefetcherParam prefetch_param;
+  prefetch_param.InitAllowUnknown(kwargs);
   n_parsed_ = 0;
   overflow = false;
   rnd_.seed(kRandMagic + record_param_.seed);
   int maxthread, threadget;
-  #pragma omp parallel
-  {
-    // be conservative, set number of real cores
-    maxthread = std::max(omp_get_num_procs(), 1);
-  }
-  param_.preprocess_threads = std::min(maxthread, param_.preprocess_threads);
-  #pragma omp parallel num_threads(param_.preprocess_threads)
-  {
-    threadget = omp_get_num_threads();
+  if (prefetch_param.ctx == PrefetcherParam::CtxType::kCPU) {
+    threadget = engine::OpenMP::Get()->GetRecommendedOMPThreadCount();
 
 Review comment:
   Since prefetching is happening in parallel with op execution. won't this cause too many threads to be launched when we are also useing openmp threads to execute operators.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services