piiswrong 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_r140148260
########## 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"); Review comment: We have `dmlc::GetEnv("OMP_NUM_THREADS", 4)` for this, which is cross-platform ---------------------------------------------------------------- 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