cjolivier01 commented on a change in pull request #7854: Basic CPU Kernel OMP 
selection based upon whether GPU has been used
URL: https://github.com/apache/incubator-mxnet/pull/7854#discussion_r140546316
 
 

 ##########
 File path: src/engine/threaded_engine.h
 ##########
 @@ -293,6 +299,24 @@ class ThreadedEngine : public Engine {
     finished_cv_.notify_all();
   }
 
+  /*! \brief Return default OMP thread count. Currently, this is whatever OMP 
shows as number
+   * of procs
+   */
+  static int DefaultOMPThreadsPerWorker() {
+#ifdef _OPENMP
+    // If environment variable is set and it's not empty, then use 
omp_get_max_threads()
+    // (Check environment directly, since OMP_NUM_THREADS mnay have odd 
formatting (i.e. 3, 2"))
+    // Taking max including omp_get_max_threads() in case this implementation 
of OMP accounts for
+    // hyperthreading
+    const char *s = getenv("OMP_NUM_THREADS");
+    const int max_threads = s && *s ? omp_get_max_threads() : 
std::max(omp_get_max_threads(),
+                                                                       
omp_get_num_procs());
 
 Review comment:
   I will just change to  omp_get_max_threads(). I am working on managing this 
directly for nested situations soon anyway, so this function is going to be 
moot anyway.
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to