You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by jx...@apache.org on 2017/11/30 01:01:30 UTC

[incubator-mxnet] branch master updated: Profiler: set cpu/gpu num during execution (#8722)

This is an automated email from the ASF dual-hosted git repository.

jxie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git


The following commit(s) were added to refs/heads/master by this push:
     new 47a71a6  Profiler: set cpu/gpu num during execution (#8722)
47a71a6 is described below

commit 47a71a68bf84b7223abe4ea4c78b6c01498ceb55
Author: oshima <yu...@gmail.com>
AuthorDate: Thu Nov 30 10:01:28 2017 +0900

    Profiler: set cpu/gpu num during execution (#8722)
    
    * set cpu/gpu num during execution
    
    Signed-off-by: YujiOshima <yu...@gmail.com>
    
    * include cuda_utils.h only when MXNET_USE_CUDA is true
    
    Signed-off-by: YujiOshima <yu...@gmail.com>
    
    * Profiler: GPU use constant number
    
    Signed-off-by: YujiOshima <yu...@gmail.com>
---
 src/engine/profiler.cc | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/engine/profiler.cc b/src/engine/profiler.cc
index 21c476f..44ad138 100644
--- a/src/engine/profiler.cc
+++ b/src/engine/profiler.cc
@@ -31,8 +31,13 @@
 #include <chrono>
 #include <iostream>
 #include <fstream>
+#include <thread>
 #include "./profiler.h"
 
+#if MXNET_USE_CUDA
+#include "../common/cuda_utils.h"
+#endif
+
 #if defined(_MSC_VER) && _MSC_VER <= 1800
 #include <Windows.h>
 #endif
@@ -45,9 +50,7 @@ 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;

-- 
To stop receiving notification emails like this one, please contact
['"commits@mxnet.apache.org" <co...@mxnet.apache.org>'].