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 2017/11/20 18:21:01 UTC

[GitHub] piiswrong commented on a change in pull request #8722: Profiler: set cpu/gpu num during execution

piiswrong commented on a change in pull request #8722: Profiler: set cpu/gpu num during execution
URL: https://github.com/apache/incubator-mxnet/pull/8722#discussion_r152070731
 
 

 ##########
 File path: src/engine/profiler.cc
 ##########
 @@ -45,12 +50,11 @@ Profiler::Profiler()
   : state_(kNotRunning), enable_output_(false), filename_("profile.json") {
   this->init_time_ = NowInUsec();
 
-  // TODO(ziheng) get device number during execution
-  int kMaxNumCpus = 64;
-  this->cpu_num_ = kMaxNumCpus;
+  this->cpu_num_ = std::thread::hardware_concurrency();
 #if MXNET_USE_CUDA
-  int kMaxNumGpus = 32;
-  this->gpu_num_ = kMaxNumGpus;
+  int gpu_num = 0;
+  CUDA_CALL(cudaGetDeviceCount(&gpu_num));
 
 Review comment:
   We intentionally used a constant number here because we don't want to initialize cuda context before gpu is used for the first time

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services