Repository: incubator-singa
Updated Branches:
  refs/heads/master a0199588c -> c51f9264b


fixbugs; todo wait master to merge feature-sliceparam


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

Branch: refs/heads/master
Commit: ad13d038562966e503d8f865a078fa6d95758b96
Parents: 51d4c2a
Author: wang wei <[email protected]>
Authored: Tue Jun 23 15:54:47 2015 +0800
Committer: wang wei <[email protected]>
Committed: Thu Jun 25 11:49:32 2015 +0800

----------------------------------------------------------------------
 include/communication/msg.h |  3 ++-
 include/utils/cluster.h     |  1 +
 src/communication/msg.cc    | 13 +++++++++++++
 src/communication/socket.cc |  3 +--
 src/trainer/server.cc       |  2 +-
 src/utils/cluster.cc        |  1 +
 6 files changed, 19 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/ad13d038/include/communication/msg.h
----------------------------------------------------------------------
diff --git a/include/communication/msg.h b/include/communication/msg.h
index 60a359a..11b6012 100644
--- a/include/communication/msg.h
+++ b/include/communication/msg.h
@@ -16,14 +16,15 @@ namespace singa {
 class Msg {
  public:
   Msg();
+  Msg(const Msg& msg);
   ~Msg();
+  int size() const;
 
   /**
     * @param first worker/server group id
     * @param second worker/server id within the group
     * @param flag 0 for server, 1 for worker, 2 for stub
     */
-<<<<<<< HEAD
   inline void set_src(int first, int second, int flag) {
     src_ = (first << kOff1) | (second << kOff2) | flag;
   }

http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/ad13d038/include/utils/cluster.h
----------------------------------------------------------------------
diff --git a/include/utils/cluster.h b/include/utils/cluster.h
index c11874e..3830383 100644
--- a/include/utils/cluster.h
+++ b/include/utils/cluster.h
@@ -58,6 +58,7 @@ class Cluster {
    * @return global procs id, which starts from 0.
    */
   int procs_id()const {return procs_id_;}
+  void set_procs_id(int procs_id) {procs_id_ = procs_id;}
   bool server_worker_separate() const {
     return cluster_.server_worker_separate();
   }

http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/ad13d038/src/communication/msg.cc
----------------------------------------------------------------------
diff --git a/src/communication/msg.cc b/src/communication/msg.cc
index 4f41077..7ee8cad 100644
--- a/src/communication/msg.cc
+++ b/src/communication/msg.cc
@@ -7,11 +7,24 @@ Msg::Msg() {
   msg_ = zmsg_new();
 }
 
+Msg::Msg(const Msg& msg){
+  src_=msg.src_;
+  dst_=msg.dst_;
+  type_=msg.type_;
+  target_first_=msg.target_first_;
+  target_second_=msg.target_second_;
+  msg_=zmsg_dup(msg.msg_);
+}
+
 Msg::~Msg() {
   if (msg_ != nullptr)
     zmsg_destroy(&msg_);
 }
 
+int Msg::size() const{
+  return zmsg_content_size(msg_);
+}
+
 void Msg::add_frame(const void* addr, int nBytes) {
   zmsg_addmem(msg_, addr, nBytes);
 }

http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/ad13d038/src/communication/socket.cc
----------------------------------------------------------------------
diff --git a/src/communication/socket.cc b/src/communication/socket.cc
index 2039162..c6925d8 100644
--- a/src/communication/socket.cc
+++ b/src/communication/socket.cc
@@ -90,8 +90,7 @@ Router::~Router() {
       zmsg_destroy(&msg);
   }
 }
-
-int Router::Bind(string endpoint){
+int Router::Bind(std::string endpoint){
   int port=-1;
   if(endpoint.length()){
     port=zsock_bind(router_, "%s", endpoint.c_str());

http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/ad13d038/src/trainer/server.cc
----------------------------------------------------------------------
diff --git a/src/trainer/server.cc b/src/trainer/server.cc
index 5185c51..9e0dee3 100644
--- a/src/trainer/server.cc
+++ b/src/trainer/server.cc
@@ -76,7 +76,7 @@ void Server::Run(){
           if(i!=group_id_) {
             Msg* tmp=sync;
             if(i<cluster->nserver_groups()-1)
-              tmp= new Msg(sync);
+              tmp= new Msg(*sync);
             tmp->set_dst(i, server_locator_->at(param), kServer);
             tmp->set_src(group_id_, server_id_, kServer);
             dealer_->Send(&tmp);

http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/ad13d038/src/utils/cluster.cc
----------------------------------------------------------------------
diff --git a/src/utils/cluster.cc b/src/utils/cluster.cc
index d022a64..023abbe 100644
--- a/src/utils/cluster.cc
+++ b/src/utils/cluster.cc
@@ -63,6 +63,7 @@ Cluster::Cluster(const ClusterProto &cluster, int procs_id) {
 
 void Cluster::Register(const string& endpoint){
   procs_id_=cluster_rt_->RegistProc(endpoint);
+  LOG(ERROR)<<endpoint;
   CHECK_GE(procs_id_,0);
   CHECK_LT(procs_id_,nprocs());
 }

Reply via email to