singa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wan...@apache.org
Subject [1/2] incubator-singa git commit: SINGA-45 Set openblas num threads in job configuration
Date Thu, 13 Aug 2015 05:50:22 GMT
Repository: incubator-singa
Updated Branches:
  refs/heads/master 2c7edd73c -> da844afd1


SINGA-45 Set openblas num threads in job configuration

Add a configuration field (openblas_num_threads) in JobProto which specifies the num of threads
used by openblas, default to 1.
If multiple workers/servers are launched in one process, this field must be set to 1 (according
to openblas wiki page).


Project: http://git-wip-us.apache.org/repos/asf/incubator-singa/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-singa/commit/2da5e23e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-singa/tree/2da5e23e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-singa/diff/2da5e23e

Branch: refs/heads/master
Commit: 2da5e23e6d5f5a5728243d8ece4c4d48dc28db29
Parents: 7a61a68
Author: Wei Wang <wangwei@comp.nus.edu.sg>
Authored: Wed Aug 12 19:29:50 2015 +0800
Committer: Wei Wang <wangwei@comp.nus.edu.sg>
Committed: Wed Aug 12 19:33:45 2015 +0800

----------------------------------------------------------------------
 include/singa.h     | 7 ++++++-
 src/proto/job.proto | 1 +
 2 files changed, 7 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/2da5e23e/include/singa.h
----------------------------------------------------------------------
diff --git a/include/singa.h b/include/singa.h
index 6eca6c4..c8984e5 100644
--- a/include/singa.h
+++ b/include/singa.h
@@ -2,6 +2,7 @@
 #define SINGA_SINGA_H_
 #include <gflags/gflags.h>
 #include <glog/logging.h>
+#include <cblas.h>
 
 #include "utils/common.h"
 #include "proto/job.pb.h"
@@ -24,9 +25,13 @@ void SubmitJob(int job, bool resume, const JobProto& jobConf) {
   if (singaConf.has_log_dir())
     SetupLog(singaConf.log_dir(),
         std::to_string(job) + "-" + jobConf.model().name());
+  if (jobConf.num_openblas_threads() != 1)
+    LOG(WARNING) << "openblas is set with " << jobConf.num_openblas_threads()
+      << " threads";
+  openblas_set_num_threads(jobConf.num_openblas_threads());
   Trainer trainer;
   trainer.Start(job, resume, jobConf, singaConf);
 }
-} /* singa */
+}  // namespace singa
 #endif  //  SINGA_SINGA_H_
 

http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/2da5e23e/src/proto/job.proto
----------------------------------------------------------------------
diff --git a/src/proto/job.proto b/src/proto/job.proto
index 3b22470..09d8e9f 100644
--- a/src/proto/job.proto
+++ b/src/proto/job.proto
@@ -3,6 +3,7 @@ package singa;
 message JobProto {
   required ClusterProto cluster = 1;
   required ModelProto model = 2;
+  optional int32 num_openblas_threads = 3 [default = 1];
 }
 
 message ClusterProto {


Mime
View raw message