ZhennanQin 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_r299318132
 
 

 ##########
 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:
   No. For CPU optimized data loader, prefetching isn't happened.
   Prefetching will flush cache, causing CPU op execution much slower. So for 
CPU optimized data loader, the loader itself works as a normal operator, which 
will be executed exclusively, utilizing all omp threads.

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to